Edit

Share via


INamingContainer Interface

Definition

Identifies a container control that creates a new ID namespace within a Page object's control hierarchy. This is a marker interface only.

public interface INamingContainer
Derived

Examples

The following code example demonstrates a templated custom server control that implements the INamingContainer interface. When this custom server control is used in an .aspx file, it will provide a unique namespace for any server controls that it contains.

using System;
using System.Collections;
using System.Web;
using System.Web.UI;

namespace TemplateControlSamples {

    public class RepeaterItem : Control, INamingContainer {

        private int itemIndex;
        private object dataItem;

        public RepeaterItem(int itemIndex, object dataItem) {
            this.itemIndex = itemIndex;
            this.dataItem = dataItem;
        }

        public object DataItem {
            get {
                return dataItem;
            }
        }

        public int ItemIndex {
            get {
                return itemIndex;
            }
        }
    }
}

Remarks

Any control that implements this interface creates a new namespace in which all child control ID attributes are guaranteed to be unique within an entire application. The marker provided by this interface allows unique naming of the dynamically generated server control instances within the Web server controls that support data binding. These controls include the Repeater, DataGrid, DataList, CheckBoxList, ChangePassword, LoginView, Menu, SiteMapNodeItem, and RadioButtonList controls.

When you develop templated controls, you should implement this interface to avoid naming conflicts on a page. For more information, see ASP.NET Control Designers Overview.

Extension Methods

GetDefaultValues(INamingContainer)

Gets the collection of the default values for the specified data control.

GetMetaTable(INamingContainer)

Gets the table metadata for the specified data control.

SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>)

Sets the table metadata and default value mapping for the specified data control.

SetMetaTable(INamingContainer, MetaTable, Object)

Sets the table metadata and default value mapping for the specified data control.

SetMetaTable(INamingContainer, MetaTable)

Sets the table metadata for the specified data control.

TryGetMetaTable(INamingContainer, MetaTable)

Determines whether table metadata is available.

EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>)

Enables Dynamic Data behavior for the specified data control.

EnableDynamicData(INamingContainer, Type, Object)

Enables Dynamic Data behavior for the specified data control.

EnableDynamicData(INamingContainer, Type)

Enables Dynamic Data behavior for the specified data control.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also