473,385 Members | 1,817 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,385 software developers and data experts.

Web User Control doesn't show up at page load

fh
Hello!
I use a that I include in code behind in a placeholder
in page_load:

-----------------
PlaceHolder2.Controls.Clear();
_DowntimeDetail= new MES.ascx.DowntimeDetails();
PlaceHolder2.Controls.Add(_DowntimeDetail);
------------------

but the control doesn't show up when I request the page
(the control is made of with textbox and label)

for a test I have added this little code in page_load
------
PlaceHolder2.Controls.Add(new Button());
------

and this time it worked!! the button appeared???

What am I missing????
Nov 19 '05 #1
9 2712
fh wrote:
Hello!
I use a that I include in code behind in a placeholder
in page_load:

-----------------
PlaceHolder2.Controls.Clear();
_DowntimeDetail= new MES.ascx.DowntimeDetails();
PlaceHolder2.Controls.Add(_DowntimeDetail);
------------------

but the control doesn't show up when I request the page
(the control is made of with textbox and label)

for a test I have added this little code in page_load
------
PlaceHolder2.Controls.Add(new Button());
------

and this time it worked!! the button appeared???

What am I missing????


does the control work if you place it on the form from the IDE instead
of from code in a placeholder?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #2
fh
Curt_C [MVP] wrote:
fh wrote:
Hello!
I use a that I include in code behind in a placeholder
in page_load:

-----------------
PlaceHolder2.Controls.Clear();
_DowntimeDetail= new MES.ascx.DowntimeDetails();
PlaceHolder2.Controls.Add(_DowntimeDetail);
------------------

but the control doesn't show up when I request the page
(the control is made of with textbox and label)

for a test I have added this little code in page_load
------
PlaceHolder2.Controls.Add(new Button());
------

and this time it worked!! the button appeared???

What am I missing????

does the control work if you place it on the form from the IDE instead
of from code in a placeholder?

Yes it work properly when dragged and dropped in the form with VS studio.
I tought about doing so, but i need to access the member of the control
and I haven't find a way to access the object 'control' in code behind

So i created it on page_load....
Nov 19 '05 #3
fh wrote:
Curt_C [MVP] wrote:
fh wrote:
Hello!
I use a that I include in code behind in a placeholder
in page_load:

-----------------
PlaceHolder2.Controls.Clear();
_DowntimeDetail= new MES.ascx.DowntimeDetails();
PlaceHolder2.Controls.Add(_DowntimeDetail);
------------------

but the control doesn't show up when I request the page
(the control is made of with textbox and label)

for a test I have added this little code in page_load
------
PlaceHolder2.Controls.Add(new Button());
------

and this time it worked!! the button appeared???

What am I missing????


does the control work if you place it on the form from the IDE instead
of from code in a placeholder?

Yes it work properly when dragged and dropped in the form with VS studio.
I tought about doing so, but i need to access the member of the control
and I haven't find a way to access the object 'control' in code behind

So i created it on page_load....


you should be able to access any public member of that control from
code.. but that's a different story. Trying to see why the PlaceHolder
isnt' acessing it properly....

Hmmm... thinking...

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #4

Try

PlaceHolder2.Controls.Clear();
PlaceHolder2.Controls.Add(new MES.ascx.DowntimeDetails());
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #5
fh
Curt_C [MVP] wrote:

Try

PlaceHolder2.Controls.Clear();
PlaceHolder2.Controls.Add(new MES.ascx.DowntimeDetails());

Thanks for your help!
I tried it but it still doesn't work... :(

But to go around the pb, I could just drop it on the page
but How can I access it?
Because, I don't understand something:
if a had a button in my page with VS
the control appear in the code behind and i can access it easily.

how come if i do the same with a web user control
it doesn't appear anywhere else than in the design view?

Franck
Nov 19 '05 #6
fh wrote:
Curt_C [MVP] wrote:

Try

PlaceHolder2.Controls.Clear();
PlaceHolder2.Controls.Add(new MES.ascx.DowntimeDetails());

Thanks for your help!
I tried it but it still doesn't work... :(

But to go around the pb, I could just drop it on the page
but How can I access it?
Because, I don't understand something:
if a had a button in my page with VS
the control appear in the code behind and i can access it easily.

how come if i do the same with a web user control
it doesn't appear anywhere else than in the design view?

Franck


Couple options.
Either make the button in the UC public, then you can access it from the
page containing it, or put the code in the codebehind of the UC

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #7
fh
Curt_C [MVP] wrote:
fh wrote:
Curt_C [MVP] wrote:

Try

PlaceHolder2.Controls.Clear();
PlaceHolder2.Controls.Add(new MES.ascx.DowntimeDetails());

Thanks for your help!
I tried it but it still doesn't work... :(

But to go around the pb, I could just drop it on the page
but How can I access it?
Because, I don't understand something:
if a had a button in my page with VS
the control appear in the code behind and i can access it easily.

how come if i do the same with a web user control
it doesn't appear anywhere else than in the design view?

Franck


Couple options.
Either make the button in the UC public, then you can access it from the
page containing it, or put the code in the codebehind of the UC

Ok But when I drop my UC in the page,
VS give it an ID
this same ID that i can't access in code behind
and that is not declared at all in the code behind class??

Nov 19 '05 #8
> Ok But when I drop my UC in the page,
VS give it an ID
this same ID that i can't access in code behind
and that is not declared at all in the code behind class??


the UC isnt declared? If so, just manually add the declaration.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #9
fh
Curt_C [MVP] wrote:
Ok But when I drop my UC in the page,
VS give it an ID
this same ID that i can't access in code behind
and that is not declared at all in the code behind class??


the UC isnt declared? If so, just manually add the declaration.


simple as that!

thank you very much for your help

for the place holder Someone found it out:
the place holder is calling the render on each of it's child control
so as UC inherits from System.Web.UI.UserControl
and not from System.Web.UI.Control

it miss the implementation of chilcontrol & render...

Nov 19 '05 #10

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

Similar topics

4
by: John | last post by:
Hi all, I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols: 1. If I have a couple of usercontrols embedded within a few tables cells on my...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
5
by: mytestemailaccount | last post by:
Hi, Hope you can help. I am relatively new to all this but would appreciate the groups help. The scenario: I am c# and asp.net to create a web application. The web page contains a user...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
3
by: PJ6 | last post by:
I need to add a user control in code, not through the designer. For some reason it just doesn't show up. Is there some initialization method I need to call for the control before attemptin to add...
9
by: TCORDON | last post by:
I have a user control that contains 2 image buttons, when you click one of them, both must change the image source, the thing is that the first time you click any one of them the page appears to do...
0
by: John Smith | last post by:
ASP.Net 2.0 / C# / IIS 6 I have 2 pages. The master page consists of a tabbed menu created using the Menu and MultiView controls. Something like this: ...
2
by: Andy B | last post by:
How do you use css in a user control? I need to put the css in a stylesheet outside of the control.
3
balabaster
by: balabaster | last post by:
I've got a user control that builds a table of dynamic data based on a :LINQ class holding the data. The data is loaded using the LoadData(DataInstance) method. The table it builds contains a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.