我得到这个纯HTML:
<label for="txtPais">Pais:</label> <input name="ctl00$ContentPlaceHolder1$txtPais" type="text" id="ctl00_ContentPlaceHolder1_txtPais" class="textInput" />@H_404_4@在我在Visual Studio中的实际代码我有这个:
<label for="txtPais">Pais:</label> <asp:TextBox ID="txtPais" runat="server" CssClass="textInput"></asp:TextBox>@H_404_4@如何应用此文本框的标签?
解决方法
您应该使用< asp:Label ...>详细的在
this blog post在哈克德
<asp:Label id="label" AssociatedControlId="txtPais" Text="Pais:" runat="server" /> <asp:TextBox id="txtPais" runat="server" CssClass="textInput" />@H_404_4@这将正确转换正在转换的ID。