Send Multiple rows sent to another page gridview

Asked By Hozefa Unwala
09-Feb-10 11:02 AM
Earn up to 0 extra points for answering this tough question.
I have one gridview with checkbox  in one page.In this page if i have been select checkbox only that rows are stored in querstring.Now i want to send selected rows send to another page.Whatever the rows i have been selected on previous page only that rows to be display in the new page and it must be inside the gridview.
Thank you

  re: Send Multiple rows sent to another page gridview

Huggy Bear replied to Hozefa Unwala
09-Feb-10 11:42 PM
There are two ways to achieve

1. Send the Unique indexes of the selected gridview rows as comma seperated through the query string. But make sure that in the new page you split the string using Split(',') function and retrieve the data from database based on the indexes.

2. Else make use of Session object. Instead of passing the rows through query string stored them in a session object and access the same session object in the new page.

  re: Send Multiple rows sent to another page gridview

Sreekumar P replied to Hozefa Unwala
10-Feb-10 12:51 AM
hi,

the best and simple method for is to pass the ids or row index which u are checked and get data according to the ids from the next page.

u cant access a control from previous page until unless u have done a Server.Transfer replacing Response.Redirect()

  Hi

Darshan Manjunath replied to Sreekumar P
15-Feb-10 05:51 AM

Hi,

If you are using DataTable as DataSource you can Cache the DataTable in new Object Add a new temp Column
called TempSelected(DataType DBType.Bit) Set Default value to 0 .

On grid cell change event - (Check if ActiveCell key is Check box) If Yes
Get the Value of the Active cell and Update Datable ( if checked set TempSelected Value to  1)

Set the new Filtered DataView as DataSouce to new Grid in the next Page.

DataView dv = new DataView(DataTable.DefaultView);
(dv.RowFilter = "TempSelected = 1")

DataGrid.DataSource = dv;

This is one way you can go with.



Hope this helps!
Regards
gmdarsh

Create New Account