System.Web.UI Namespace Control Class
Returns a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same Control.ID property value.
Script |
Control.NamingContainer |
This property can only be used programmatically; it cannot be set when declaring the control.
The server control's naming container.
Each page in an ASP.NET Web application contains a hierarchy of controls. This hierarchy is not dependent on whether a control generates UI visible to the user. The naming container for a given control is the parent control above it in the hierarchy that implements the INamingContainer interface. A server control that implements this interface creates a unique namespace for the ID property values of its child server controls.
Creating a unique namespace for server controls is particularly important when you bind data against list Web server controls, such as the Repeater and DataList server controls. When multiple entries in the data source create multiple instances of a server control that is a child of the repeating control, the naming container ensures that each instance of these child controls have UniqueID property values that do not conflict. The default naming container for a page is the instance of the Page class generated when that page is requested.
You can use this property to determine the naming container where a specific server control is located.
Control Members INamingContainer UniqueID Control.ID