Solved

Adding ascx control to Composite Control.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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