User control with sub controls

  • Thread starter Thread starter PEK
  • Start date Start date
P

PEK

I know how to create and use user controls, by I find them sometimes to
limited. I sometimes want to creating something like this:

<test:mycontrol runat="server">
<p>Some text</p>
</test:mycontrol>

I also want to do something like this:

<test:mymenu runat="server">
<test:mymenuitem>Item 1</test:mymenuitem>
<test:mymenuitem>Item 2</test:mymenuitem>
<test:mymenuitem>Item 3</test:mymenuitem>
<test:mymenuitem>Item 4</test:mymenuitem>
</test:mymeny>

But when I tries do that in a control a gets an error message like
"Literal content ('xyz') is not allowed within a
'ASP.thecontrol_ascx'". Is it possible to solve this problem?

PEK
 
The best resource I've found for helping build custom controls like this
is "ASP.NET Server Controls and Components". It goes into good detail showing
how to design & build controls (and how to apply the custom attributes) to
get what you want.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Thanks, I didn't know it was server controls I was searching for :-).
And the book seems to be interesting too.

PEK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top