AdawiAdawi
asked on
Store DataTable in view state
Hi All,
I have a datatable object I want to store it in Viewstate but some times an error occurred (not usual
Error: Sys.WebForms.PageRequestMa nagerServe rErrorExce ption: Error serializing value 'Table1' of type 'System.Data.DataTable.'
Any help Please
I have a datatable object I want to store it in Viewstate but some times an error occurred (not usual
Error: Sys.WebForms.PageRequestMa
Any help Please
ASKER
But why I cant use the viewstate, and whey it sometimes working normally and sometimes not ?
DataTable size might increase some times so better to use session..
but if you wanna use viewstate then write code like:
First store datatable values to viewstate ViewState["tempDatatable"] = datatable;
Now to retrieve the same
datatable = (DataTable)(viewstate["tem pDAtatable "].ToStrin g())
but if you wanna use viewstate then write code like:
First store datatable values to viewstate ViewState["tempDatatable"]
Now to retrieve the same
datatable = (DataTable)(viewstate["tem
ASKER
Dear indrajitmahajan I know how I can store and retrieve in view viewstate
you can check the issue above :)
you can check the issue above :)
It might be based on number of rows stored in datatable that affects the viewstate
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I found the solution for my question :)
Session[dt] = datatableobj;