Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 08, 2011 08:07 AM by praveenrockz
Participant
1510 Points
2249 Posts
Mar 05, 2011 11:56 PM|LINK
<asp:Label ID="Label1" runat="server" AssociatedControlID="txtFirstName">First Name:</asp:Label>
Hi,
What this mean AssociatedControlID?
Regards
Contributor
4035 Points
1079 Posts
Mar 06, 2011 12:12 AM|LINK
It tells label, where focus should go once the label is clicked.
Please see below example. If you click on "Enter First Name" label, focus will go to FirstName textbox. If you click on "Enter Last Name" label, focus will go to LastName textbox.
Please try this
<form id="form1" runat="server"> <div> <asp:Label ID="lblFirstName" runat="server" Text="Enter First Name" AssociatedControlID="txtFirstName" /> <asp:TextBox ID="txtFirstName" runat="server" /> <asp:Label ID="lblLastName" runat="server" Text="Enter Last Name" AssociatedControlID="txtLastName" /> <asp:TextBox ID="txtLastName" runat="server" /> </div> </form>
Please refer
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.associatedcontrolid.aspx
http://www.codedigest.com/CodeDigest/48-AssociatedControlID-property-in-ASP-Net-Label-Control.aspx
http://dotnetslackers.com/Community/blogs/simoneb/archive/2006/07/03/143.aspx
Mar 06, 2011 01:23 AM|LINK
I also would like to mention how above server code will be rendered as HTML. please see below.
Please observe the HTML attribute "for"
<label for="txtFirstName" id="lblFirstName">Enter First Name</label> <input name="txtFirstName" type="text" id="txtFirstName" />
<label for="txtLastName" id="lblLastName">Enter Last Name</label> <input name="txtLastName" type="text" id="txtLastName" />
All-Star
95503 Points
14106 Posts
Mar 06, 2011 10:27 PM|LINK
Read about AssociatedControlId -
Thanks.
Member
55 Points
26 Posts
Aug 08, 2011 08:07 AM|LINK
Thanks ...
programercek
Participant
1510 Points
2249 Posts
What this mean: AssociatedControlID ?
Mar 05, 2011 11:56 PM|LINK
<asp:Label ID="Label1" runat="server" AssociatedControlID="txtFirstName">First Name:</asp:Label>
Hi,
What this mean AssociatedControlID?
Regards
duttavr
Contributor
4035 Points
1079 Posts
Re: What this mean: AssociatedControlID ?
Mar 06, 2011 12:12 AM|LINK
It tells label, where focus should go once the label is clicked.
Please see below example. If you click on "Enter First Name" label, focus will go to FirstName textbox.
If you click on "Enter Last Name" label, focus will go to LastName textbox.
Please try this
<form id="form1" runat="server"> <div> <asp:Label ID="lblFirstName" runat="server" Text="Enter First Name" AssociatedControlID="txtFirstName" /> <asp:TextBox ID="txtFirstName" runat="server" /> <asp:Label ID="lblLastName" runat="server" Text="Enter Last Name" AssociatedControlID="txtLastName" /> <asp:TextBox ID="txtLastName" runat="server" /> </div> </form>Please refer
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.associatedcontrolid.aspx
http://www.codedigest.com/CodeDigest/48-AssociatedControlID-property-in-ASP-Net-Label-Control.aspx
http://dotnetslackers.com/Community/blogs/simoneb/archive/2006/07/03/143.aspx
Please Mark as Answer, if it answers you, also correct me if I'm wrong.
duttavr
Contributor
4035 Points
1079 Posts
Re: What this mean: AssociatedControlID ?
Mar 06, 2011 01:23 AM|LINK
I also would like to mention how above server code will be rendered as HTML. please see below.
Please observe the HTML attribute "for"
<label for="txtFirstName" id="lblFirstName">Enter First Name</label> <input name="txtFirstName" type="text" id="txtFirstName" /><label for="txtLastName" id="lblLastName">Enter Last Name</label> <input name="txtLastName" type="text" id="txtLastName" />Please Mark as Answer, if it answers you, also correct me if I'm wrong.
ramiramilu
All-Star
95503 Points
14106 Posts
Re: What this mean: AssociatedControlID ?
Mar 06, 2011 10:27 PM|LINK
Read about AssociatedControlId -
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.associatedcontrolid.aspx
Thanks.
JumpStart
praveenrockz
Member
55 Points
26 Posts
Re: What this mean: AssociatedControlID ?
Aug 08, 2011 08:07 AM|LINK
Thanks ...