[Mono-list] System.Web.UI.INamingContainer

Nick Drochak ndrochak@gol.com
Tue, 6 Nov 2001 17:16:57 +0900


| I was wondering what good is this interface for?
|     It does not have any member / method to be implemented!
|
| The documentation reads:
|     Identifies a container control that creates a new ID
| namespace within a
| Page object's control hierarchy. This is a marker interface only.
|
|     What do you mean by a "marker interface only"? Unable to make
| any sense
| out of it.
|

From the docs on Composite Control:
"INamingContainer is a marker interface that has no methods. When a control
implements INamingContainer, the ASP.NET page framework creates a new naming
scope under that control, thus ensuring that the child controls have unique
names in the hierarchical tree of controls. However, you should not
implement this interface unless your control needs it, because there is an
overhead in creating a new naming scope."

So, ASP.NET looks for it and does some special work if it's there.  "Marker"
in this case means you "mark" your class as needing special treatment by
ASP.NET. You only need it to have this interface in your class if (again
according to the docs):
-If the control provides databinding.
-If the control is a templated control.
-If the control needs to route events to its child controls

HTH,
Nick D.