asp.net - Is it possible to add a UserControl to a Composite control? -


I am trying to create a composite control which is flexible, based on some parameters, I would like to load the control in my User Controller in the CreateChildControls method. Accurate UserControls do not know design at the time

Just as a quick example, I tried with "strict coded" user control and it failed:

  protected Override Zero CreateChildControls () {Control UserControlControl = Page.LoadControl (Typf (MyUser Control), Faucet); Controls.Add (UserControlControl); Label regular controller = new label (); RegularControl.Text = "This is displayed"; Controls.Add (RegularControl);     

Try the following:

  Protected Override Zero CreateChildControls () {Control UserControlControl = Page.LoadControl ("~ / path / to / control.ascx"); Controls.Add (UserControlControl); }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -