Home All Groups Group Topic Archive Search About

How do I create a custom webcontrol that can have xml inside it's tag?

Author
18 Jan 2006 3:06 PM
Allan Ebdrup
How do I create a custom webcontrol that can have xml inside it's tag?
I mean a control like the repeater control, where I can specify special tags
that define the header body and footer of the control.
I'm thinking of something like:
<uc1:CustomControl ID="Control1" runat="server">
<Header>Some text and perhaps other controls</Header>
<Body>Some more text</Body>
<Footer>Even more text</Footer>
</uc1:CustomControl>

Is there a technical term for this? I haven't been able to find information
about this.

Kind Regards,
Allan Ebdrup

Author
18 Jan 2006 9:08 PM
Keith Patrick
ParseChildrenAttribute(false) should get you started.  ASP.Net by default
tries to deserialize child markup to the owning object, but if you disable
child parsing, you can control it yourself.
Author
19 Jan 2006 9:37 AM
Allan Ebdrup
"Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message
news:%235ZRPNHHGHA.1028@TK2MSFTNGP11.phx.gbl...
> ParseChildrenAttribute(false) should get you started.  ASP.Net by default
> tries to deserialize child markup to the owning object, but if you disable
> child parsing, you can control it yourself.

Thanks,
I've found that I need to create a custom Control Builder for my control,
since creating a custom control builder runs at compiletime while overriding
..AddSubParsedObject  runs at runtime. The samples I've found online aren't
very informative, I haven't found examples that explain how I can create a
Control Builder that finds custom tags inside its tags and handles them like
the repeater control.
Any help on creating custom control builders is appreciated.
I'll keep investigating.

some of the links I've looked at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconwebformscontrolbuilderoverview.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcreatingcustomcontrolbuilder.asp

http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/ctrlauth/customparsing/CustomParse2.src&file=CS\CustomParse2.cs&font=3
Author
19 Jan 2006 11:52 AM
Allan Ebdrup
I've tried to get the sample:
http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/ctrlauth/templates/Repeater1.src&file=CS\Repeater1.aspx&font=3
to work but it keeps saying that The TemplateControlSamples:Repeater1 tag in
the aspx page cant have content between it's opening and closing tags.
What am I doing wrong?