J
JohnyStyles
I have a templated user control which looks like this:
-----------------------------------------------------------------
<uc:MyUserControl runat=server>
<TemplateProperty>
</TemplateProperty>
</uc:MyUserControl>
-----------------------------------------------------------------
Currently i can drop any html/web controls/user controls into
TemplateProperty. I then handle these inside of my user control, in
the PreRender, I do run:
_templateProperty.InstantiateIn(aPlaceHolderInsideUserControl);
This all works. Very nice, allows for great content encapsulation.
Now, what I would like to do next is limit what controls are allowable
INSIDE of the TemplateProperty. An example would be only allowing
'asp:Label' to be used, or as in my case, another usercontrol which
I've created.
So idealy, once one types:
-----------------------------------------------------------------
<Template Property>
<[ctrl-space]
-----------------------------------------------------------------
intelisense only allows you to populate the Template Property with
controls that are allowable, i.e. asp:Label, or a another specified
user control, or something of that nature.
ASP.NET actually already does this with some webcontrols. for an
example, look at:
-----------------------------------------------------------------
<aspataGrid runat=server>
<Columns>
</Columns>
</aspataGrid>
-----------------------------------------------------------------
inside of the Templated Property, Columns, one can only choose from:
<asp:BoundColumn />
<asp:ButtonColumn />
<asp:EditCommandColumn />
<asp:HyperLinkColumn />
<asp:TemplateColumn />
Any other control inserted in <Columns> will cause compile errors:
Error 4 Validation (ASP.Net): Text is not allowed between the opening
and closing tags for element Columns'.
I'd like to have this same functionality with my controls. Any help
would be greatly appreciated!
Thanx Much,
John Pequeno
.... just another Computer Engineer
-----------------------------------------------------------------
<uc:MyUserControl runat=server>
<TemplateProperty>
</TemplateProperty>
</uc:MyUserControl>
-----------------------------------------------------------------
Currently i can drop any html/web controls/user controls into
TemplateProperty. I then handle these inside of my user control, in
the PreRender, I do run:
_templateProperty.InstantiateIn(aPlaceHolderInsideUserControl);
This all works. Very nice, allows for great content encapsulation.
Now, what I would like to do next is limit what controls are allowable
INSIDE of the TemplateProperty. An example would be only allowing
'asp:Label' to be used, or as in my case, another usercontrol which
I've created.
So idealy, once one types:
-----------------------------------------------------------------
<Template Property>
<[ctrl-space]
-----------------------------------------------------------------
intelisense only allows you to populate the Template Property with
controls that are allowable, i.e. asp:Label, or a another specified
user control, or something of that nature.
ASP.NET actually already does this with some webcontrols. for an
example, look at:
-----------------------------------------------------------------
<aspataGrid runat=server>
<Columns>
</Columns>
</aspataGrid>
-----------------------------------------------------------------
inside of the Templated Property, Columns, one can only choose from:
<asp:BoundColumn />
<asp:ButtonColumn />
<asp:EditCommandColumn />
<asp:HyperLinkColumn />
<asp:TemplateColumn />
Any other control inserted in <Columns> will cause compile errors:
Error 4 Validation (ASP.Net): Text is not allowed between the opening
and closing tags for element Columns'.
I'd like to have this same functionality with my controls. Any help
would be greatly appreciated!
Thanx Much,
John Pequeno
.... just another Computer Engineer