I created a new webapart and added it to a page. After adding, I was unable to save the page from editing mode, but if I remove my webpart and try to save, it's saving. Not sure what is the error.
Can any one let me know what might be the problem?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI created a new webapart and added it to a page. After adding, I was unable to save the page from editing mode, but if I remove my webpart and try to save, it's saving. Not sure what is the error.
Can any one let me know what might be the problem?
You need to modify any validation code in your web part to ignore validation if the page is in edit mode.
You can do this server side using this code snippet in in the web-part. Make sure to add this using statment as well. using System.Web.UI.WebControls;
//if we are not in display mode disable all the validation controls to make sure saving the page the webpart is on works.
if (WebPartManager.DisplayMode != WebPartManager.BrowseDisplayMode)
{
foreach (var validator in Controls)
{
if (validator is BaseValidator)
{
((BaseValidator)validator).Enabled = false;
}
}
}
Sometimes I see this and am able to resolve it by going to site content / pages and manually checking out the page. I am not sure why this is a problem but I have had success with this workaround.
This seems like library version is on. So the page you edit will only reflect to admin user. Unless and until you check in the page other users can't see changes.
I have seen this before, my solution is that if your WebPart has any validator, you should fill some data to pass this/these validator(s) for saving your page. It often happens in SharePoint. Hope to help you.