Re: Error serializing value 'Table1' of type 'System.Data.DataTable.'

Discussion in 'ASP .Net' started by bruce barker, Jan 2, 2007.

  1. bruce barker

    bruce barker Guest

    if you store an unserializable object in a table, then it is no longer
    serilizable. you will need to write a serializer/deserialzer for each of
    your controls.


    -- bruce (sqlwork.com)



    Adam wrote:
    > I need to store a collection of dynamically loaded controls in my User
    > Control. Each control is linked to a headerid and a headerid can have many
    > controls. My first dead end was to use a List<int, Control>, but that would
    > not serialize at all. I since changed to using a DataTable. My DataTable is
    > not serializing (the error message is the title of this post). Please help.
    > Here is some code:
    >
    > private DataTable LoadedControlsDT
    > {
    > get
    > {
    > if (ViewState[LocalViewStateKeys.LoadedCtrls] == null)
    > {
    > DataTable dt = new DataTable();
    > DataColumn dc = new DataColumn("headerid", typeof(int));
    > dt.Columns.Add(dc);
    >
    > dc = new DataColumn("control", typeof(Control));
    > dt.Columns.Add(dc);
    >
    > ViewState[LocalViewStateKeys.LoadedCtrls] = dt;
    > }
    > return (DataTable)ViewState[LocalViewStateKeys.LoadedCtrls];
    > }
    > set
    > {
    > ViewState[LocalViewStateKeys.LoadedCtrls] = value;
    > }
    > }
    bruce barker, Jan 2, 2007
    #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. Chun
    Replies:
    0
    Views:
    711
  2. ssafavi
    Replies:
    1
    Views:
    398
    Lee Fesperman
    Apr 28, 2004
  3. trint
    Replies:
    1
    Views:
    542
    Mark Fitzpatrick
    Apr 18, 2007
  4. akappa

    Serializing a glib data type

    akappa, Aug 19, 2007, in forum: C Programming
    Replies:
    10
    Views:
    587
    Justin Spahr-Summers
    Aug 20, 2007
  5. Daves
    Replies:
    0
    Views:
    110
    Daves
    Jan 17, 2006
Loading...

Share This Page