Passing grid data from one page to another

G

Guest

I am posting a page to another page (form post). The data grid on the second
page is being populated with data. Now, on page load of the second page, I
would like to send the grid data on this page to the first page and populate
the grid on the first page with the same data on second page. Please let me
know how can I do this.

Thanks,
Vasantha
 
G

Grant Merwitz

You can session the DataSource, and rebind it.

This bears some overhead though.
I would suggest initially pulling the Data our of the Cache for the first
page,
then again for the second.

If in the first page, the user makes some changes to the data, and thats
what you want to display,
then you can Take the DataSet out of the DataGrids datasource, and session
that to rebind it in the 2nd Page.

Something like:
PAGE1:

DataSet ds = (DataSet)DataGrid.DataSource; //If you used a datsource
Session["MyDataSet"] = ds;

PAGE2:

DataSet ds = (DataSet)Session["MyDataSet"];
DataGrid2.DataSource = ds;
DataGrid2.DataBind;

HTH
 
G

Grant Merwitz

Sorry
"//If you used a datsource"

was meant to read:
If you used a DataSET


Grant Merwitz said:
You can session the DataSource, and rebind it.

This bears some overhead though.
I would suggest initially pulling the Data our of the Cache for the first
page,
then again for the second.

If in the first page, the user makes some changes to the data, and thats
what you want to display,
then you can Take the DataSet out of the DataGrids datasource, and session
that to rebind it in the 2nd Page.

Something like:
PAGE1:

DataSet ds = (DataSet)DataGrid.DataSource; //If you used a datsource
Session["MyDataSet"] = ds;

PAGE2:

DataSet ds = (DataSet)Session["MyDataSet"];
DataGrid2.DataSource = ds;
DataGrid2.DataBind;

HTH

Vasantha peddireddy said:
I am posting a page to another page (form post). The data grid on the
second
page is being populated with data. Now, on page load of the second page,
I
would like to send the grid data on this page to the first page and
populate
the grid on the first page with the same data on second page. Please let
me
know how can I do this.

Thanks,
Vasantha
 
G

Guest

Hi,

That worked perfect. But you mentioned that by using session variables,
there will be some overhead. How can I programmatically handle this problem.

Thanks,
Vasantha

Grant Merwitz said:
You can session the DataSource, and rebind it.

This bears some overhead though.
I would suggest initially pulling the Data our of the Cache for the first
page,
then again for the second.

If in the first page, the user makes some changes to the data, and thats
what you want to display,
then you can Take the DataSet out of the DataGrids datasource, and session
that to rebind it in the 2nd Page.

Something like:
PAGE1:

DataSet ds = (DataSet)DataGrid.DataSource; //If you used a datsource
Session["MyDataSet"] = ds;

PAGE2:

DataSet ds = (DataSet)Session["MyDataSet"];
DataGrid2.DataSource = ds;
DataGrid2.DataBind;

HTH

Vasantha peddireddy said:
I am posting a page to another page (form post). The data grid on the
second
page is being populated with data. Now, on page load of the second page, I
would like to send the grid data on this page to the first page and
populate
the grid on the first page with the same data on second page. Please let
me
know how can I do this.

Thanks,
Vasantha
 
G

Grant Merwitz

That depends on how your using the data.

Like is said before, if it is not something the user is changing and then
wanting to review on the 2nd page,
i.e., it is just the same set of data on 2 pages,
i would suggest pulling this data from the Cache on both instances.
(ofcourse if it doesn't exist on the first page, you can place it in the
Cache on the first request, but it will be there for all users untill the
cache expires or is manually cleared).


Alternately you could save this into sessions, but multiply the size of the
data your sessioning by the number of users at any given time for the length
of the sessions.
So, probably not a wise idea.
In this case it might be more efficient to call it out of the database
again, which might slow down the site on an individual user basis, yet speed
it up for the whole site in general (and not punish your server too much
either)

So it really depends on how you using this data.

If the data is user specific and cannot be Cached, in this instance i would
either pull it out of the database on both pages, or built the functionality
of both pages into one page and use viewstate.

If the data is not user specific, and can be Cached for all users, this is
by far the best approach.
But i would avoid sessioning DataSets

Vasantha peddireddy said:
Hi,

That worked perfect. But you mentioned that by using session variables,
there will be some overhead. How can I programmatically handle this
problem.

Thanks,
Vasantha

Grant Merwitz said:
You can session the DataSource, and rebind it.

This bears some overhead though.
I would suggest initially pulling the Data our of the Cache for the first
page,
then again for the second.

If in the first page, the user makes some changes to the data, and thats
what you want to display,
then you can Take the DataSet out of the DataGrids datasource, and
session
that to rebind it in the 2nd Page.

Something like:
PAGE1:

DataSet ds = (DataSet)DataGrid.DataSource; //If you used a datsource
Session["MyDataSet"] = ds;

PAGE2:

DataSet ds = (DataSet)Session["MyDataSet"];
DataGrid2.DataSource = ds;
DataGrid2.DataBind;

HTH

"Vasantha peddireddy" <[email protected]>
wrote
in message news:[email protected]...
I am posting a page to another page (form post). The data grid on the
second
page is being populated with data. Now, on page load of the second
page, I
would like to send the grid data on this page to the first page and
populate
the grid on the first page with the same data on second page. Please
let
me
know how can I do this.

Thanks,
Vasantha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top