Click here to Skip to main content
15,895,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I had set of data in datalist..But i want to use that datalist as Session variable ........How its Possible? Anyone help me please.........
Posted

1 solution

Just put it in the session then.
C#
MyDataList myDataListObj = new MyDataList();
Session["MyDataListRef"] = myDataListObj;

When you want to work with it again...
C#
myDataListObj = Session["MyDataListRef"] != null ? (MyDataList)Session["MyDataListRef"] : null;
 
Share this answer
 
Comments
SnvMohan 15-Apr-13 9:48am    
If i need to store that datalist into another datalist means,

DataSet ds=new dataSet();
ds=Session["MyDataListRef"];

Datalist2.datasource=ds;
Datalist2.databind();

It is correct ?
fjdiewornncalwe 15-Apr-13 9:52am    
Yes. That should work.
SnvMohan 15-Apr-13 9:55am    
Thank you........So Much.......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900