Sharepoint Validation Webpart

When we add/make  client side validation in Webpart or ASCX control and we want to add that control on
Page it shows several error like “his page contains content or formatting that is not valid.
You can find more information in the affected sections. Important StatusPublication Start Date: Immediately Important StatusStatus: Checked out and editable”

To resolve this error Add this code in your WebPart


public class LenderProjectWP : WebPart
// Visual Studio might automatically update this path when you change the Visual Web Part project item.
private const string _ascxPath = @”~/_CONTROLTEMPLATES/Prject Name/UserConteol.ascx”;

protected override void CreateChildControls()

WebPartManager wp = WebPartManager.GetCurrentWebPartManager(this.Page);

if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)


Control control = Page.LoadControl(_ascxPath);




One thought on “Sharepoint Validation Webpart

  1. Or you could just make the required selections, or fill the required fields in the web part when adding it or modifying the page where the web part is on. After that just save the page.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s