Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a control dynamically
Message
From
21/04/2006 06:59:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/04/2006 01:24:53
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01115236
Message ID:
01115306
Views:
9
This message has been marked as the solution to the initial question of the thread.
>Is there a way to add a control dynamically on a Web form? I would like to add a label control named Javascript everytime a Page_Load() event occurs. I have one right now but I have to paste it on all my Web forms. I thought there could be a way to do that in my generic Page_Load() code.

Yes there is. Controls.Add(...) or Controls.AddAt(...). ie:
 Label myLabel = new Label();
 myLabel.Text = "This is added at runtime:" + DateTime.Now.ToString();
 Controls.Add(myLabel);
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform