How to use the

后端 未结 8 2124

How can I use the tag within an ASP.NET application? I want it to be valid, accessible, and usable.

I understand the optimal HTML way is t

相关标签:
8条回答
  • 2020-12-01 03:26

    If you are using .NET 4 you can now use the ClientIDMode property to configure one or more controls to use static or predictable ID's. The ClientIDMode property can be set on the TextBox directly or you can set it on any parent control or the containing page.

    <label for="Username">Username:</label>
    <asp:TextBox ID="Username" runat="server" ClientIDMode="Static" />
    

    Read more about the ClientIDMode on MSDN

    0 讨论(0)
  • 2020-12-01 03:32

    use the <asp:Label> server control. It has a property that you can use to set the associated control ID.

    <asp:Label ID="label1" runat="server" Text="Username" AssociatedControlID="Text1" />
    <asp:TextBox ID="Text1" runat="server" />
    
    0 讨论(0)
提交回复
热议问题