ASP.NET NamingContainer Property

Definition and Usage

The NamingContainer property retrieves a reference to the naming container of the server control, which creates a unique namespace to distinguish server controls with the same Control.ID attribute value.

Example

This example demonstrates the NamingContainer of the button control:

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

Example

Display the NamingContainer of Button Control