SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  1. I created user control1.ascx and put in controls template folder
  2. then add visual webpart in the visual webpart ascx control1.ascx i registered in visual webpart ascx control and the deployee but sharepoint visual webpart not displaying control1.ascx
share|improve this question

I suppose you might need to do the same thing for your inner control that the webpart itself does for its control:

// Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/ControlInsideControlWebPart/VisualWebPart1/VisualWebPart1UserControl.ascx";

        protected override void CreateChildControls()
            Control control = Page.LoadControl(_ascxPath);

But it will be in the Page_Load event of you visual web part user control.

share|improve this answer

Check your declaration there are should be 3 main parts in the ascx file:

  1. Tag registration - <%@ Register TagPrefix="mycontrol" TagName="simplecontrol" Src="~/_CONTROLTEMPLATES/mycontrol.ascx" %>
  2. Reference to assambly which contains code behinde of your control- <%@ Assembly Name="assemblyname" %>
  3. Control declaration to markup - <mycontrol:simplecontrolID="simplecontrol" runat="server" />
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.