Serialiazing CollectionBase

Discussion in 'ASP .Net Building Controls' started by Victor Irzak, Apr 29, 2004.

  1. Victor Irzak

    Victor Irzak Guest

    Hello...
    I the following class deriving from CollectionBase:

    ============================
    public class YYYepC : System.Collections.CollectionBase
    {
    int i = 9;

    [DefaultValue(4)]
    [PersistenceMode(PersistenceMode.Attribute)]
    public int I
    {
    get {return i;}
    set {i=value;
    }
    }
    }
    ============================

    When I try to serialize it in my web control, the "I" property doesn't get
    serialized. Only the sollection items get serialized.

    Here is my control:
    ============================
    public class WebChartingControl : System.Web.UI.WebControls.WebControl
    {

    YYYepC da2 = new YYYepC();

    [PersistenceMode(PersistenceMode.InnerProperty)]
    [NotifyParentProperty(true)]
    public YYYepC YYYepC
    {
    get {return da2;}
    set {da2 = value;}
    }
    }
    ============================


    How can I serialize all the other properties?

    Thanks,

    Victor
    Victor Irzak, Apr 29, 2004
    #1
    1. Advertising

  2. I don't think I can answer your question but might be able to point you in
    the right direction... Collections are intended to be serialized as items to
    the Control when used this way. I use them to serialize inner tags to be
    used by the control like the DataGrid uses Columns.

    I think you are going to need to create a custom designer to process the
    collection class so it does the properties of the collection instead of the
    items of the collection. Take a look into DesignerSerializerAttribute class
    to see if there are examples for it out there...

    Fred

    "Victor Irzak" <> wrote in message
    news:...
    > Hello...
    > I the following class deriving from CollectionBase:
    >
    > ============================
    > public class YYYepC : System.Collections.CollectionBase
    > {
    > int i = 9;
    >
    > [DefaultValue(4)]
    > [PersistenceMode(PersistenceMode.Attribute)]
    > public int I
    > {
    > get {return i;}
    > set {i=value;
    > }
    > }
    > }
    > ============================
    >
    > When I try to serialize it in my web control, the "I" property doesn't get
    > serialized. Only the sollection items get serialized.
    >
    > Here is my control:
    > ============================
    > public class WebChartingControl : System.Web.UI.WebControls.WebControl
    > {
    >
    > YYYepC da2 = new YYYepC();
    >
    > [PersistenceMode(PersistenceMode.InnerProperty)]
    > [NotifyParentProperty(true)]
    > public YYYepC YYYepC
    > {
    > get {return da2;}
    > set {da2 = value;}
    > }
    > }
    > ============================
    >
    >
    > How can I serialize all the other properties?
    >
    > Thanks,
    >
    > Victor
    >
    >
    Fred Hirschfeld, Apr 30, 2004
    #2
    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. Replies:
    3
    Views:
    914
    Natty Gur
    Nov 3, 2003
  2. Steve Mauldin
    Replies:
    0
    Views:
    368
    Steve Mauldin
    Aug 27, 2004
  3. Vadivel Kumar

    Performance of CollectionBase class

    Vadivel Kumar, Feb 15, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,501
    Vadivel Kumar
    Feb 17, 2005
  4. Web Team @ Borough of Poole

    Returning CollectionBase from WebService

    Web Team @ Borough of Poole, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,303
    Web Team @ Borough of Poole
    Apr 27, 2005
  5. Rachel Koktava

    Binding custom objects to datagrid WITHOUT using Collectionbase

    Rachel Koktava, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    208
    Rachel Koktava
    Sep 15, 2003
Loading...

Share This Page