In ASP.Net Label control, there is a property called AssociatedControlID. This property changes the behaviour of the label control after rendering.
e.g. We have a label control...
<asp:Label ID="lblSearch" Text="Search" runat="server" />
After running the page, go to so View --> Source... and you will get like this :
<span id="lblSearch">Search</span>
This means label contol render to a simple html element.
So, after adding the AssociatedControlID property and taking a contol (I'm taking a text box) to be associated...
<asp:Label ID="lblSearch" Text="Search" runat="server" associatedcontrolid="txtSearch"/>
<asp:textbox id="txtSearch" runat="server"/>
Now run the page and go to View --> Source...You will find something different.
<label id="lblSearch" for="txtSearch">Search</label>
<input id="txtSearch" name="txtSearch">
Now the Label control rendered a
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment