如何在ASP.Net网络表单中使用标签? [英] How to use label for in an ASP.Net webform?
本文介绍了如何在ASP.Net网络表单中使用标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到的是纯HTML:
I get this as pure HTML:
<label for="txtPais">Pais:</label>
<input name="ctl00$ContentPlaceHolder1$txtPais" type="text" id="ctl00_ContentPlaceHolder1_txtPais" class="textInput" />
在Visual Studio的实际代码中,我有以下内容:
In my actual code in Visual Studio I have this:
<label for="txtPais">Pais:</label>
<asp:TextBox ID="txtPais" runat="server" CssClass="textInput"></asp:TextBox>
如何为该文本框应用标签?
How would I apply a label for this textbox?
推荐答案
You should use the <asp:Label...>
as detailed in this blog post on Haacked
<asp:Label id="label" AssociatedControlId="txtPais" Text="Pais:" runat="server" />
<asp:TextBox id="txtPais" runat="server" CssClass="textInput" />
这应该正确转换并带有要转换的ID.
This should convert correctly with the ID being converted.
这篇关于如何在ASP.Net网络表单中使用标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文