ASP.NET UniqueID Property

Definition and Usage

The UniqueID property retrieves the unique, hierarchical-limited identifier of the server control.

This property is different from the ID property because the UniqueID property includes the identifier of the server control naming container. This identifier is automatically generated when handling page requests.

Example

This example displays the UniqueID of the button control:

<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs)
  Response.Write("UniqueID is: " & button1.UniqueID)
End Sub
</script>
<form runat="server" >
<asp:Button ID="button1" OnClick="Button1_Click"
Text="Get UniqueID" runat="server" />
</form>

Example

Display the UniqueID of the button control