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