P
Peter Hemmingsen
Hi
Im storing a (very small) DataTable in ViewState as follows:
DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dt.Rows.Add (dr);
ViewState ["MyTable"]=dt;
When a button is pressed I read the DataTable from ViewState and add a row:
DataTable dt=ViewState["MyTable"];
DataRow dr = dt.NewRow();
dt.Rows.Add (dr);
at this point I would have saved the new datatable dt in ViewState but using
the debugger I can see that the ViewState datatable is already modified. I
would have expected
DataTable dt=ViewState["MyTable"];
to make a copy but it looks more like a reference?
I would appreciate if somebody could explain this,- thanks.
Peter
Im storing a (very small) DataTable in ViewState as follows:
DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dt.Rows.Add (dr);
ViewState ["MyTable"]=dt;
When a button is pressed I read the DataTable from ViewState and add a row:
DataTable dt=ViewState["MyTable"];
DataRow dr = dt.NewRow();
dt.Rows.Add (dr);
at this point I would have saved the new datatable dt in ViewState but using
the debugger I can see that the ViewState datatable is already modified. I
would have expected
DataTable dt=ViewState["MyTable"];
to make a copy but it looks more like a reference?
I would appreciate if somebody could explain this,- thanks.
Peter