472,806 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

<label> element in ASP.NET

How can you correctly use the <labelelement in asp.net? does the label
custom control corelate to this tag correctly in the same way in that if you
click it it will select the tied element? thanks
Dec 28 '06 #1
7 1764
The <asp:Labeltag renders to a <spanin HTML and is most akin to a label
on a windows form. The <labeltag, in HTML, is hidden and provides a
wrapper to allow text to toggle a control. The two controls are NOT the
same.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

********************************************
Think outside the box!
********************************************
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:uE**************@TK2MSFTNGP02.phx.gbl...
How can you correctly use the <labelelement in asp.net? does the label
custom control corelate to this tag correctly in the same way in that if
you click it it will select the tied element? thanks
Dec 28 '06 #2
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:uE**************@TK2MSFTNGP02.phx.gbl...
How can you correctly use the <labelelement in asp.net?
Same as any other HTML element...
does the label custom control corelate to this tag correctly in the same
way in that if you click it it will select the tied element? thanks
If, by "label custom control" you are referring to the <asp:Label>
webcontrol, no - that renders a <spantag.

BTW, <labelis not supported by all browsers, specifically Safari, the most
popular Mac browser...
Dec 28 '06 #3
wierd, because for me it renders as "label" when associated with a
control...

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:uE**************@TK2MSFTNGP02.phx.gbl...
>How can you correctly use the <labelelement in asp.net?

Same as any other HTML element...
>does the label custom control corelate to this tag correctly in the same
way in that if you click it it will select the tied element? thanks

If, by "label custom control" you are referring to the <asp:Label>
webcontrol, no - that renders a <spantag.

BTW, <labelis not supported by all browsers, specifically Safari, the
most popular Mac browser...

Dec 28 '06 #4
I have this in my aspx page

<asp:Label ID="Label4" runat="server" AssociatedControlID="txtEmail"
Text="E-Mail Address:"></asp:Label><asp:TextBox ID="txtEmail"
MaxLength="200" Width="365px" runat="server"></asp:TextBox>

when it renders it renders as this

<label for="ctl00_ContentPlaceHolder1_txtEmail"
id="ctl00_ContentPlaceHolder1_Label4">E-Mail Address:</label><input
name="ctl00$ContentPlaceHolder1$txtEmail" type="text" maxlength="200"
id="ctl00_ContentPlaceHolder1_txtEmail" style="width:365px;" />
Dec 28 '06 #5
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
wierd, because for me it renders as "label" when associated with a
control...
You're quite correct - my mistake.

Apologies.
Dec 28 '06 #6
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I have this in my aspx page

<asp:Label ID="Label4" runat="server" AssociatedControlID="txtEmail"
Text="E-Mail Address:"></asp:Label><asp:TextBox ID="txtEmail"
MaxLength="200" Width="365px" runat="server"></asp:TextBox>

when it renders it renders as this

<label for="ctl00_ContentPlaceHolder1_txtEmail"
id="ctl00_ContentPlaceHolder1_Label4">E-Mail Address:</label><input
name="ctl00$ContentPlaceHolder1$txtEmail" type="text" maxlength="200"
id="ctl00_ContentPlaceHolder1_txtEmail" style="width:365px;" />
Yes indeed.

According to MSDN
(http://msdn2.microsoft.com/en-us/lib...controlid.aspx)
this is supported in v2.0 and v3.0 of the Framework
Dec 28 '06 #7
ok good so im not going crazy then :)

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:O8****************@TK2MSFTNGP03.phx.gbl...
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>I have this in my aspx page

<asp:Label ID="Label4" runat="server" AssociatedControlID="txtEmail"
Text="E-Mail Address:"></asp:Label><asp:TextBox ID="txtEmail"
MaxLength="200" Width="365px" runat="server"></asp:TextBox>

when it renders it renders as this

<label for="ctl00_ContentPlaceHolder1_txtEmail"
id="ctl00_ContentPlaceHolder1_Label4">E-Mail Address:</label><input
name="ctl00$ContentPlaceHolder1$txtEmail" type="text" maxlength="200"
id="ctl00_ContentPlaceHolder1_txtEmail" style="width:365px;" />

Yes indeed.

According to MSDN
(http://msdn2.microsoft.com/en-us/lib...controlid.aspx)
this is supported in v2.0 and v3.0 of the Framework

Dec 28 '06 #8

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

Similar topics

2
by: Xerxes | last post by:
Hi, can you tell me how I can make a <label> hidden? I have hidden the field after the label: var M_Hide = isNS4?'hide':'hidden'; var M_Show = isNS4?'show':'visible'; ..... <label...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
1
by: John Smith | last post by:
I created a dataTable that returns a value from a stored procedure. How would I bind that results of a query to an <asp:label>? Thank you!
5
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather...
3
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644"...
1
by: Hongbo | last post by:
Hi, I have a mobile form: === <body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm"> <mobile:Form id=Form1 runat="server"> <mobile:label runat="server" id="lblT" /> </mobile:Form>...
0
by: CharlesA | last post by:
Hi folks, I'm using ASP.net 1.1 with C# I've got this kind of thing going <div class="row"> <label class="col1">Rm Name</label> <asp:textbox id="txtRM" runat="server" cssclass="col2"...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
3
Dormilich
by: Dormilich | last post by:
Hi, I just have one thing about the label element, where I’m not certain. <label> is commonly used to attach visual/text information to a form control. so far, so good. <!-- just to make it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.