InnerProperty Persistance for Collections containing other Collections

Discussion in 'ASP .Net Building Controls' started by mutex, Jul 27, 2003.

  1. mutex

    mutex Guest

    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.
     
    mutex, Jul 27, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Atif Jalal

    collection of Objects persistance

    Atif Jalal, Aug 13, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    361
    Atif Jalal
    Aug 13, 2003
  2. Free
    Replies:
    2
    Views:
    1,105
    Brian
    Oct 20, 2003
  3. jahyen
    Replies:
    0
    Views:
    2,496
    jahyen
    Jan 6, 2005
  4. Doug Poland
    Replies:
    9
    Views:
    735
    VisionSet
    Sep 27, 2003
  5. jahyen

    Properties with PersistenceMode.InnerProperty not saved

    jahyen, Jan 6, 2005, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    236
    jahyen
    Jan 7, 2005
Loading...

Share This Page