473,513 Members | 10,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assigning text to a label in a dynamic control

From a fairly good understanding of traditional ASP I am
taking my first tentative steps into C#. Within Visual
Studio, my first test is as follows:

Default.aspx contains a placeholder
---------
<asp:placeholder id="phPage"
runat="server"></asp:placeholder>
---------

The code behind (Default.aspx.cs) loads a web user control
into the placeholder
---------
// Create layout web user control and add to page
placeholder
Control ctrlLayout = new Control();
ctrlLayout = LoadControl("UI/Layout.ascx");
phPage.Controls.Add(ctrlLayout);
---------

Layout.ascx itself contains a placeholder
---------
<asp:placeholder id="phContent"
runat="server"></asp:placeholder>
---------

The code behind (Layout.ascx.cs) loads a web user control
into the placeholder
---------
// Create text web user control and add to content
placeholder
Control ctrlText = new Control();
ctrlText = LoadControl("UI/Text.ascx");
phContent.Controls.Add(ctrlText);
---------

Finally, Text.ascx contains a label
---------
<asp:Label id="lblText" runat="server"></asp:Label>
---------

My intent is to be able to present the same text string
using different versions of Layout.ascx and Text.ascx
(e.g., Layout_001.ascx, Layout_002.ascx) and so ideally
would like to be able to assign a text string to
lblText.Text in the code behind Default.aspx. I would like
to know if this is possible and if so how to achieve it.

Thanks in advance.
Steven
Nov 15 '05 #1
0 1436

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

Similar topics

0
950
by: OguzhanF | last post by:
I have a list box of products a coffee machine has to produce, that the user can choose from. After they do their selection of products, into a panel control i dynamically create textboxes with...
1
1688
by: mhnazly | last post by:
i'm trying to read data from SQL Server database using data reader and assigned it to a label in my asp.net web application. but when the button is clicked, nothing appears. please help, thanks. ...
3
1070
by: Prince Hoff Jr. | last post by:
How can I create a link so that when it is clicked, a description appears. For example. Microsoft <== when this is clicked the following text appears below it. "Number one software company" ...
1
3331
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new...
1
4284
by: sekisho | last post by:
I'm dynamically adding a column of labels and a column of text boxes to a panel on a webform, based on data returned from an SQL query, which the user builds by selecting options from a few...
4
1629
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
12
13135
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the...
4
6012
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
1
19791
DebadattaMishra
by: DebadattaMishra | last post by:
Introduction In case of rich applications, you must have observed that a text field behaves like a dynamic combo box. When the user enters some characters in the text field, a popup will come up...
0
7254
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
7153
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
7373
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,...
1
7094
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...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.