Sharepoint Page is not saving – Disabling WebPart form Validators in Edit Mode

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;
        }
    }
}

manuel11g

Leave a Reply