pen*_*ake 2 asp.net tags label
我非常喜欢HTML标签,通过检查其'for'属性,可以很容易地看到哪个标签代表哪个输入元素.你知道,像:
<label for="txtInput"> Enter your name</label>
<input type="text" id="txtInput" />
Run Code Online (Sandbox Code Playgroud)
是否可以在asp.net Label控件中执行类似的操作,以便我可以看到它代表什么是输入控件?我看不到那个属性.没有扩展控制?
谢谢!
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.associatedcontrolid.aspx
<asp:label AssociatedControlID="textbox1" runat="server" id="lblOne" />
<asp:textbox id="textbox1" runat="server" />
Run Code Online (Sandbox Code Playgroud)
未经测试但沿着这些方向......