I'm having problems using Session variables since they are used as a Link and I want to use them as a value .
I got to this debugging of my solution, and I created something like:
DataTable dt =
(DataTable)HttpContext.Current.Session[
"SearchReturn-DataTableSchema"];
// Adding Rows of Data to DataTable dt
HttpContext.Current.Session["SearchReturn-DataTable"] = dt;
((DataTable)HttpContext.Current.Session[
"SearchReturn-DataTableSchema"]).Rows.Clear();
return dt;
my idea was to have only a DataTable in a DataTableSchema using a column layout and in a DataTable ) columns + rows.
The problem is that when I delete all rows from a DataTableSchema , the dt variable will also be cleared and (!!)
How can this be avoided? How to assign a variable (in this case, a session variable) as a value, and not as a link?
Thank.
Answer
this
DataTable dt = (DataTable)Session["SearchReturn-DataTableSchema"];
:
DataTable dt = ((DataTable)Session["SearchReturn-DataTableSchema"]).Copy();
: -)