control exposing collection.

A

Ashish

Hi all,
Iam trying to design a web server control using asp.net 2.0, that has a
collection exposed. so that user can specify list elements in the markup.

like

<uc1:MyControl id="Mycontrol1" runat="server" property1="value">
<Item name="value" prop1="value"></Item>
</uc1:MyControl>

wondering if the item class has to be a control too, and how should i
expose this collection so that asp.net realizes this as a valid markup,
and populates the objects at page load...


any help would be appreciated.

TIA
 
K

Keith Patrick

Check out the ParseChildrenAttribute class. That affects how your class is
deserialized (parsed) by the asp engine such that you can handle child
elements differently than the default. The default behavior, I believe, is
to attempt to add them as children of the Controls collection, in which
case, a) it would need to be a control, and b) you'd need to qualify it with
a tagname so that the engine knows what type to deserialize the markup to.
 
A

Ashish

Thanks Keith,

i found an example of a control at by using ControlBuilder class on
http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder

I did exactly as mentioned in the sample by defining three classes, one
for the main control, one for the child control, and one for the
ControlBuilder, and then by decorating the main control class with the
derived ControlBuilder


but now the XHTML validator throws error saying that child element not
supported !, and would show object reference error on the design view of
the form

am i missing anything ?

thanks for your help again
 
A

Ashish

never mind i found out what the problem was :)

Thanks Keith,

i found an example of a control at by using ControlBuilder class on
http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder


I did exactly as mentioned in the sample by defining three classes, one
for the main control, one for the child control, and one for the
ControlBuilder, and then by decorating the main control class with the
derived ControlBuilder


but now the XHTML validator throws error saying that child element not
supported !, and would show object reference error on the design view of
the form

am i missing anything ?

thanks for your help again
 
A

Ashish

never mind i found out what the problem was :)

Thanks Keith,

i found an example of a control at by using ControlBuilder class on
http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder


I did exactly as mentioned in the sample by defining three classes, one
for the main control, one for the child control, and one for the
ControlBuilder, and then by decorating the main control class with the
derived ControlBuilder


but now the XHTML validator throws error saying that child element not
supported !, and would show object reference error on the design view of
the form

am i missing anything ?

thanks for your help again
 
A

Ashish

never mind i found out what the problem was :)

Thanks Keith,

i found an example of a control at by using ControlBuilder class on
http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder


I did exactly as mentioned in the sample by defining three classes, one
for the main control, one for the child control, and one for the
ControlBuilder, and then by decorating the main control class with the
derived ControlBuilder


but now the XHTML validator throws error saying that child element not
supported !, and would show object reference error on the design view of
the form

am i missing anything ?

thanks for your help again
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top