Solved

Adding ascx control to Composite Control.

Posted on 2009-07-15
3
422 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

21 Experts available now in Live!

Get 1:1 Help Now