Resolve Webpart Error: This page contains content or formatting that is not valid

Leave a Comment
Hi All,

In Some Cases,While adding webpart in page if we willface the below error
This page contains content or formatting that is not valid. You can find more information in the affected sections”

To Resolve the error, follow the below Procedure,

Copy the below code in .cs file of particular webpart in CreateChildControls() method and deploy your solution .

WebPartManager wp = WebPartManager.GetCurrentWebPartManager(this.Page);
if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
base.CreateChildControls();
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}


This will happen due to Validations our page.

Related Post

0 comments:

Post a Comment