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

{

base.CreateChildControls();

Control control = Page.LoadControl(_ascxPath);

Controls.Add(control);

}

}

Leave a comment