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