I read in MSDN InamingContainer is a marker interface for creating unique name. When is it really necessary ?
Frankly, it's required when your control has a child with an id. Whereas you can use multiple instances of your control on a single page, you have to mark your control with INamingContainer
interface. This is the most senario for CompositeControls
, thus it has derived INamingContainer
by default.
From INamingContainer Interface
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With