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

 

[ToolboxItemAttribute(false)]
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)
{

base.CreateChildControls();

Control control = Page.LoadControl(_ascxPath);

Controls.Add(control);

}
}
}