Error: This 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.

working with validation controls in the visual webpart, an error arise when you place the webpart on to the page, actually on the edit mode SharePoint doesn’t allow the validation controls.

To do the code gig,go to webpart class file and

protected override void CreateChildControls()        {


//added piece of code

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

if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)

//piece of code ended



Control control = Page.LoadControl(_ascxPath);




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 )

Facebook photo

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

Connecting to %s