InnerProperty Persistance for Collections containing other Collections

M

mutex

Hi All,

Interesting problem.

SETUP:

Class A
{
string _name;
BCollection _b;

public string Name{get;set} -- code ommited sets/returns _name
public string BItemList{get;set} -- code ommited sets/returns
bcollection

}

Class B
{
string _id;
public string Name{get;set} -- code ommited returns _id
}

Class ACollection : CollectionBase
{
...Code ommited
}

Class BCollection : CollectionBase
{
...Code ommited
}


myControl : WebControl
{
ACollection _list;

[Bindable(true), Category("Data"),
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Vis
ible),
NotifyParentPropertyAttribute(true),
PersistenceModeAttribute(PersistenceMode.InnerProperty ),
]
public virtual ACollection ItemList
{
get {return _list;}
}

So that is the setup. This is what WebForm designer will save in the aspx
file (uc1 is the registered tag prefix):
<uc1:myControl>
<ItemList>
<uc1:A Name="someting" BList="(Collection)" />
<ItemList>
</uc1:mycontrol>

Notice that BList is an attribute and its wrong, designer will throw an
error. So the question is, how to make VS Designer save BCollection so its
treated the same way as ACollection (like below) or any ideas on how to go
about it.

<uc1:myControl>
<ItemList>
<uc1:A Name="someting">
<BItemList>
<uc1:B Name="someting"/>
</BItemList>
</uc1:A>
<ItemList>
</uc1:mycontrol>

Thanks in advance.
Peter.
 

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

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top