Home > Code > ASP.NET > How to store DataTable in session and retrieve it again in asp.net?

How to store DataTable in session and retrieve it again in asp.net?

by Thamil   on Sep 20, 2013   Category: ASP.NET   |  Views: 11386    |  Points: 25   |  Gold 


Sometime we need to store dataTable to session in a asp.net application, below simple code shows how to store and get the DataTable in session.

//To store dataTable in session:

DataTable dtTest = new DataTable();
Session["dtTest"] = dtTest;

//To retrieve DataTable from Session:

DataTable dt = (DataTable) Session["dtTest "];



Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts