using Session-object ??

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...
 
M

Marina

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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top