473,386 Members | 1,867 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,386 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 1798
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.