Sep 27, 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)


{

base.CreateChildControls();
//Render your code here
}

}

Once you do this, while you are editing the webpart (toolpart properties that is) your webpart won't load t he required field validators and you can safely publish the page with updated webpart properties

No comments:

Post a Comment