By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,394 Members | 1,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,394 IT Pros & Developers. It's quick & easy.

using Session-object ??

P: n/a
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...
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <cm****@yahoo.com> wrote in message
news:O7**************@TK2MSFTNGP10.phx.gbl...
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...
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.