Solved

Adding ascx control to Composite Control.

Posted on 2009-07-15
3
427 Views
Last Modified: 2013-11-07
My page contains a composite control and I am trying to add 'ascx' control to this composite control, which will eventually rendered on the page.

I normally load any ascx control as loadControl ("`/path/XXX.ascx")
but in my composite control I cant get loadControl() method.

any help will be greatly appreciated.
0
Comment
Question by:Merion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
jinal earned 500 total points
ID: 24861065
At Last your composite control is put into page. so inside composite control use

Control c = Page.LoadControl(""); then add to composite control.

0
 
LVL 15

Assisted Solution

by:jinal
jinal earned 500 total points
ID: 24861073
This is look like this .  This is just sample.

public class Class1 : System.Web.UI.WebControls.CompositeControl 
{
	public Class1()
	{
		
	}
    protected override void CreateChildControls()
    {
        base.CreateChildControls();
        Control c = Page.LoadControl("~/mycontrol.ascx");
        c.ID = "MyControl";
        this.Controls.Add(c);
    }
}

Open in new window

0
 

Author Comment

by:Merion
ID: 24861185
Thanks for the reply.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question