ASP.NET ClientID 属性

定义和用法

ClientID 属性获取由 ASP.NET 生成的服务器控件标识符。

实例

本例展示 button 控件的 ClientID:

  1. <script runat="server">
  2. Sub Button1_Click(sender As Object, e As EventArgs)
  3. Response.Write("The ClientID of the button is: ")
  4. Response.Write(button1.ClientID)
  5. End Sub
  6. </script>
  7. <form runat="server" >
  8. <asp:Button ID="button1" OnClick="Button1_Click"
  9. Text="Get ClientID" runat="server" />
  10. </form>