我把它作为纯 HTML 得到:
<label for="txtPais">Pais:</label>
<input name="ctl00$ContentPlaceHolder1$txtPais" type="text" id="ctl00_ContentPlaceHolder1_txtPais" class="textInput" />
在我在 Visual Studio 中的实际代码中,我有这个:
<label for="txtPais">Pais:</label>
<asp:TextBox ID="txtPais" runat="server" CssClass="textInput"></asp:TextBox>
我将如何为这个文本框应用标签?
最佳答案
您应该使用 <asp:Label...>
详见 this blog post被黑客攻击
<asp:Label id="label" AssociatedControlId="txtPais" Text="Pais:" runat="server" />
<asp:TextBox id="txtPais" runat="server" CssClass="textInput" />
这应该与正在转换的 ID 正确转换。
关于asp.net - 如何在 ASP.Net 网络表单中使用标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3489512/