using Session-object ??

  • Thread starter Thread starter cmrchs
  • Start date Start date
C

cmrchs

Hi,

how do I 'save' a DataRow-object in ViewState or Session-object ?

Trying :
Session["Row"] = myDataSet.Tables[0].Rows[0];
or
ViewState["Row"] = myDataSet.Tables[0].Rows[0];

results in an error :

The type 'System.Data.DataRow' must be marked as
Serializable or have a TypeConverter other than
ReferenceConverter to be put in viewstate

Thnx

Chris

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
To store it in ViewState, the object must be serializable. To store in
Session, it must be serializable if you are using anything other then
InProc.

Given that, since that object is not marked as serializable, there is no way
to do it if you are using viewstate, or non-InProc session state.

What you can do, is get the object array in the ItemArray property, and
store that. If all the items in that array are serializable, then that
should work.

Chris C said:
Hi,

how do I 'save' a DataRow-object in ViewState or Session-object ?

Trying :
Session["Row"] = myDataSet.Tables[0].Rows[0];
or
ViewState["Row"] = myDataSet.Tables[0].Rows[0];

results in an error :

The type 'System.Data.DataRow' must be marked as
Serializable or have a TypeConverter other than
ReferenceConverter to be put in viewstate

Thnx

Chris

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
Back
Top