Store Datatable or string value for reuse....

Posted by sourabhghosh49-13964 under C# on 4/13/2013 | Points: 10 | Views : 3313 | Status : [Member] | Replies : 4
I want to store datatable and also want to reuse it like view statevariable.
and one more thing my data is user specific so i cant use cache. i also don't want to use session because it increase server overhead...and viewstate increase my page load.
So please suggest me another way to store user specific data and reuse it...

Thanks in advance....

sourabh


Responses

Posted by: Suwarna on: 4/14/2013 [Member] Starter | Points: 25

Up
0
Down
Hi..
You can use cookies. Cookie stores the state at client side and also user specific


sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 4/14/2013 [Member] Starter | Points: 25

Up
0
Down
Thanks for reply Suwarna.
But i think cookies is for small value of data.but i want to store datatable with 500 records.i think it is not suitable option..

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suwarna on: 4/14/2013 [Member] Starter | Points: 25

Up
0
Down
hI ..
Then this is impossible because in asp.net only 2 options session and cookie for user specific state management.


sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 4/15/2013 [Member] Starter | Points: 25

Up
0
Down
There are server-side containers to use of which the Items container could be a perfect choice.
You could wrap your DataTable with a property:

public DataTable TempData
{
get
{
if ( this.Context.Items["tempdata"] != null )
return (DataTable)this.Items["tempdata"];
return null;
}
set
{
this.Context.Items["tempdata"] = value;
}
}

Then you access the property:

this.TempData = yourdatatable;

and retrieve it somewhere

DataTable storedTable = this.TempData;

http://hashtagakash.wordpress.com/

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response