If possible execute a fresh query on the second page...or pass a primary key information in
Querysting by which you can retrieve required records.................
On the otherhand you can keep your dataset to
Session or Cache variable............but you have to consider many aspects of storing a dataset to session or cache....
here is some point :: **********************************
If you decide to save a dataset between round trips, you must decide where to keep it. This issue is the
standard one of state maintenance in Web Forms pages — where do you store information you want to
preserve between round trips?
You have two options:
On the server, save the dataset in
Session state, Application state, or using a cache. On the client — that is, in the page — save the dataset using
view state or by putting the data into your own hidden field. ( View state is also implemented using a hidden field. )
Storing the dataset on the server uses server resources. If you store too much data ( a large dataset, or many users storing small datasets ), it can affect server performance and scalability. Using a cache can partly offset this problem, because the cache manager
will discard the dataset if the server needs memory or if cached data expires. But because the dataset is not guaranteed to be in the cache, you must add logic to your page to check that the dataset is available in the cache; if not, you must recreate it and put a copy back in the cache.
Storing data in the page means that you do not need server resources to save the data. However, the data becomes part of the HTML stream of the page. If the dataset is large, it can substantially affect the
time it takes for the page to load into the user's browser and to post the page back to the server.
TIP:
Always try to keep the size of a dataset to a minimum by filling it with only the records you need.
No matter where you decide to store the dataset, you must add logic to your page to save it and restore it at the appropriate time. The following example shows a typical way to store and restore a dataset in Session state. The dataset dsCustomers1 is an instance of the dataset class dsCustomers. Note that the dataset is stored in Session state as type Object. When restoring the dataset from Session state, you must cast it from Object back to a dataset class.
- private void Page_Load ( object src, EventArgs e )
-
{
-
if ( Page.IsPostBack )
-
{
-
dsCustomers1 = ( dsCustomers ) Session [ "myDsCustomers" ];
-
}
-
else
-
{
-
if ( Session [ "myDsCustomers" ] == null )
-
{
-
oleDbDataAdapter1.Fill ( dsCustomers1 );
-
Session [ "myDsCustomers" ] = dsCustomers1;
-
}
-
}
-
}