ViewState of the Composite Control composed of custom control

Discussion in 'ASP .Net Web Controls' started by whoisnidhee, Jul 14, 2004.

  1. whoisnidhee

    whoisnidhee Guest

    I have a web server control that renders itself as a Rectangle with
    some other properties like ID etc. I have another Composite Control
    that contains an ArrayList. This ArrayList contains a collection of
    Rectangles with different IDs. The Composite Control implements the
    IPostBackEventHandler interface and contains an HTML Button control
    that generates a Postback.
    The problem is that I am unable to save the ViewState of the Composite
    Control. The error I get is "The type 'Controls.Rectangle' must be
    marked as Serializable or have a TypeConverter other than
    ReferenceConverter to be put in viewstate. "
    Marking the control as Serializable also resulted in the same error.
    whoisnidhee, Jul 14, 2004
    #1
    1. Advertising

  2. whoisnidhee

    XicoLoKo Guest

    In that case I would make these changes:

    - The ArrayList should contain Rectangle definitions (not a control by a class with each rectangle information) no Rectangle controls

    - In the CreateChildControls override of your Composite control create one Rectangle control for each rectangle information contained in the ArrayList. Add them to the composite controls collection.

    - xicokoko -

    "whoisnidhee" wrote:

    > The Rectangle is a web server control. My Composite Control is a
    > collection of the Rectangle server control.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    >
    XicoLoKo, Jul 15, 2004
    #2
    1. Advertising

  3. whoisnidhee

    Nidhee Guest

    Thanx for the help.
    I was able to do it by implementing the ISerializable interface in teh
    Rectangle class. Also, my ArrayList still contains the Rectangle
    control and is able to maintain its viewstate.

    "XicoLoKo" <> wrote in message news:<>...
    > In that case I would make these changes:
    >
    > - The ArrayList should contain Rectangle definitions (not a control by a class with each rectangle information) no Rectangle controls
    >
    > - In the CreateChildControls override of your Composite control create one Rectangle control for each rectangle information contained in the ArrayList. Add them to the composite controls collection.
    >
    > - xicokoko -
    >
    > "whoisnidhee" wrote:
    >
    > > The Rectangle is a web server control. My Composite Control is a
    > > collection of the Rectangle server control.
    > >
    > > *** Sent via Developersdex http://www.developersdex.com ***
    > > Don't just participate in USENET...get rewarded for it!
    > >
    Nidhee, Jul 16, 2004
    #3
    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. iksrazal
    Replies:
    2
    Views:
    305
    Marcin Grunwald
    Mar 8, 2005
  2. Francesc Guim Bernat

    Defining composed keys [XSD]

    Francesc Guim Bernat, Jul 29, 2003, in forum: XML
    Replies:
    0
    Views:
    470
    Francesc Guim Bernat
    Jul 29, 2003
  3. Chad
    Replies:
    0
    Views:
    219
  4. dickster
    Replies:
    0
    Views:
    224
    dickster
    Dec 8, 2005
  5. Amit
    Replies:
    0
    Views:
    850
Loading...

Share This Page