473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems dsplaying User Controls

Vi
Hi,
I have a User Control that I want to display at the top and bottom of the
web form. I have two PlaceHolders controls at the top and bottom of the page
and I'm loading the control programmatically in the placeholder control:

Control ctl = LoadControl("MyControl.ascx");
plhTop.Controls.Add(ctl);
plhBottom.Controls.Add(ctl);

The problem is that only plhBottom is displayed. If I change places of
plhTop and plhBottom in the code:

Control ctl = LoadControl("MyControl.ascx");
plhBottom.Controls.Add(ctl);
plhTop.Controls.Add(ctl);

then only plhTop is displayed.

Why doesn't this code display both controls?
Thank you.
Nov 18 '05 #1
1 1107
You can't have the same instance of a control in two separate locations.
Create a 2nd control

Control c1 = LoadControl("MyControl.ascx");
Control c2 = LoadControl("MyControl.ascx");
plhTop.Controls.Add(c1);
plhBottom.Controls.add(c2);
Karl
"Vi" <Vi@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Hi,
I have a User Control that I want to display at the top and bottom of the
web form. I have two PlaceHolders controls at the top and bottom of the page and I'm loading the control programmatically in the placeholder control:

Control ctl = LoadControl("MyControl.ascx");
plhTop.Controls.Add(ctl);
plhBottom.Controls.Add(ctl);

The problem is that only plhBottom is displayed. If I change places of
plhTop and plhBottom in the code:

Control ctl = LoadControl("MyControl.ascx");
plhBottom.Controls.Add(ctl);
plhTop.Controls.Add(ctl);

then only plhTop is displayed.

Why doesn't this code display both controls?
Thank you.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
6
by: Jason Winters | last post by:
I have implemented a user control in c# .net 2002 but the problem is that the control keeps disappearing off of the form for no reason. I am not making any changing to the form or the control. It...
1
by: john | last post by:
I have two different problems: 1. When the user has clicked on a button that is causing the browser to post back to the server, it could take a little while for the new page to show up. So in...
0
by: Vi | last post by:
Hi, I have a User Control that I want to display at the top and bottom of the web form. I have two PlaceHolders controls at the top and bottom of the page and I'm loading the control...
4
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
0
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
2
by: mdavis | last post by:
Hello, I'm using a Login Control on asp.net 2.0 website and it works fine on IE & Firefox, however I have recently added a javscript function to listen for a 'return-key-click' and am encountering...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.