Tuesday, November 19, 2013

Sharepoint web part form validation blocks saving page

Solution is:
Add the below code into the Page_load method.


// Get the current display mode of the WPM
WebPartManager wp = WebPartManager.GetCurrentWebPartManager(Page);
String mode = wp.DisplayMode.Name;

// Enable validation in BrowseDisplayMode only
if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
validatorID.Enabled = true;
}
else
{
validatorID.Enabled = false;

}
}


Refer: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartmanager.displaymode.aspx

No comments:

Post a Comment