Solved

Calling 1 user control from inside another user control

Posted on 2004-08-19
5
607 Views
Last Modified: 2012-06-22
Hi Experts

I have a Header, Content and Footer split in my Main.aspx page; what I do is call a user control on my page load event:

ContentPane.Controls.Add(Page.LoadControl("~/UC1.ascx"))
ContentPane.Visible = True

Then I want to call a second user control from in side “UC1.ascx” and put it in my HeaderPane.
For example:
HeaderPane.Controls.Add(Page.LoadControl("~/UC2.ascx"))
HeaderPane.Visible = True

How do I get this working?

Thanks for the help
Deon
0
Comment
Question by:deon001
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:saleek
ID: 11839794
0
 
LVL 35

Accepted Solution

by:
YZlat earned 240 total points
ID: 11840270
Dim uc As UserControl
 uc = New UserControl()
uc = Page.FindControl("UC2.ascx")
HeaderPane.Controls.Add(uc)
0
 

Author Comment

by:deon001
ID: 11878291
Thanks for the help.

When I use: “HeaderPane.Controls.Add(uc)” I get an error:”HeaderPane is not declared”.

I used: Response.Redirect("Home.aspx?headerpane=LoborControls/uc.ascx")

Thanks
Deon
0
 
LVL 35

Expert Comment

by:YZlat
ID: 11891318
how do you declare your HeaderPane?
0
 

Author Comment

by:deon001
ID: 11891765
In my Webpage.aspx :

<form id="Main" name="HomePage" method="post" runat="server" class="Body">
<TABLE id="Table1" width="100%" height="100%" cellpadding="0" cellspacing="0" border="3"
                        bordercolor="#296342">
      <TR>
            <TD id="HeaderPane" runat="server" height="60" bgcolor="#296342"></TD>
</TR>
      <TR>
            <TD id="MenuPane" runat="server" height="20"></TD>
      </TR>
      <TR>
            <TD id="ContentPane" runat="server"></TD>
      </TR>
      <TR>
            <TD id="FooterPane" runat="server" height="20"></TD>
      </TR>
</TABLE>
</form>

What I want to do is open a user control say UC2.ascx in the Webpage.aspx’s “HeaderPane” from inside my UC1.ascx.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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 …

770 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