Friday, October 8, 2010

This page contains content or formatting that is not valid. You can find more information in the affected sections

You get this error when you are trying to update a SharePoint webpart tool part or something like that and you click on 'Publish' page button. This only happens if you have any Validation Controls on your webpart.

Resolution: As you have validation controls on your webpart UI and you are not filling in anything, it is not letting your page to postback and you need to disable rendering the webpart while you are modifying the toolpart. You can do that by writing down code as below in your 'CreateChildControls method of webpart

protected override void CreateChildControls()
{ 

WebPartManager wp = WebPartManager.GetCurrentWebPartManager(this.Page); 
if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
// add your validator control
} 
else
{
// dont add your validator control
}

base.CreateChildControls(); 

}

Thanks & Regards,
Avinash Dad

No comments: