Solved

Adding ascx control to Composite Control.

Posted on 2009-07-15
3
420 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
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
jinal earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the reply.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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 …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now