Wednesday, April 6, 2011

Display selected row of Gridview data to next page in another Gridview?

How can i Display selected row of Gridview data to next page in another Gridview?

For example, In listing page i want to select perticular row and take that data to another page and display over there.

I have two grid view one in 1st page and next one in 2nd page. Now when i select a record in 1st page gridview, than that record will display on 2nd page gridview on submit button click from 1st page.

From stackoverflow
  • Why not have 2 gridviews, one above the other? The top gridview could be made to only show 1 record which is set to the id of the 2nd gridviews selected item identifier in code. Then in 2nd gridview, have an empty selected item template so that the selected item only shows once for both gridviews. That way the 2nd gridview is free to page through the entire set whilst the first retains the selected item for display above?

    Ashish : I have two grid view one in 1st page and next one in 2nd page. Now when i select a record in 1st page gridview, than that record will display on 2nd page gridview on submit button click from 1st page.
    Ashish : Please help me.
  • Hey,

    Pass the key of the record via the querystring... and then in rowdatabound event, select the row when the data bound record matches the key in the QS.

    For more protection, you can use session to store the variable.

    Ashish : I count not pass key of record, i have temp table. which i could not access on destination page. So i want to take whole row in container and show it to the next page grid.
    Brian : You could store the record of the object selected in session, though I don't know that this is going to be easy to do... you would have to store the entire result set in session so that you don't have to requery the result set, or bind the result set on every page load every time (not the most efficient, but it works) so that you can just work with the objects directly... hope that makes sense :-;
    Ashish : But it will not store result by row and column. I wanna display this result on next page dynamically.
    Brian : What do you mean by dynamic? I'm not sure why you are saying it won't show by row/column? It's hard without knowing more about the code...
    Ashish : can u give me a sample code?
    Brian : I cannot give you sample code because I am having a hard time understanding what you are trying to do; could you post more details/sample code?

0 comments:

Post a Comment