paging on gridview causing second gridview to not work.

Last post 04-17-2007 1:24 PM by tgneiti. 5 replies.

Sort Posts:

  • paging on gridview causing second gridview to not work.

    04-13-2007, 1:48 AM
    • Member
      182 point Member
    • tgneiti
    • Member since 09-17-2006, 11:37 PM
    • Posts 88

    I have two gridviews on a page with paging enabled on both of them.

     On page load, the first gridview is populated with select column.  When the select is clicked, it populates the second gridview.

    Problem.  When I am on page one of gridview1, the select works.  However, once I go to page two, the select does not populate the gridview2.

    It's almost as if gridview2 disappears when I go to another page on gridview1.
     

    Filed under:
  • Re: paging on gridview causing second gridview to not work.

    04-13-2007, 5:32 AM
    Answer
    • Member
      175 point Member
    • swap
    • Member since 09-27-2005, 11:40 AM
    • Posts 32

    Hi tgneiti,

    You need to select first record from gridview2, every time you change the page of gridview1. because Everytime you changing the page, selection of gridview1 is lost, so the data filled in gridview2 based on gridview1selection is also lost.

    So for this you need to select record in gridview1 on every page change (in pageindexchanging event of gridview1). and call fill method for gridview2.

     
     

    Regards,
    Swap.

    Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
    Filed under:
  • Re: paging on gridview causing second gridview to not work.

    04-13-2007, 5:44 PM
    • Member
      182 point Member
    • tgneiti
    • Member since 09-17-2006, 11:37 PM
    • Posts 88
    Thanks I'll give that a try.
  • Re: paging on gridview causing second gridview to not work.

    04-13-2007, 11:23 PM
    • Member
      182 point Member
    • tgneiti
    • Member since 09-17-2006, 11:37 PM
    • Posts 88

    I tried your request and can't seem to make it function correctly.

    It's ok that I loose selection in GridView2 when I goto a different page on Gridview1.  But when I am on page two of  GridView1 and click the select button to populate gridview2 nothing happens.  It will work correctly when I am on page 1 of Gridview1, but not for any other pages.

  • Re: paging on gridview causing second gridview to not work.

    04-17-2007, 3:31 AM

    hi, could you paste some code of your program please? It will be helpful for us to dig into/analyze your problem and help solve it.

      i want to know how the data in your Gridview2 is generated

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: paging on gridview causing second gridview to not work.

    04-17-2007, 1:24 PM
    Answer
    • Member
      182 point Member
    • tgneiti
    • Member since 09-17-2006, 11:37 PM
    • Posts 88

    Bo Chen,

    Thank you for your help, it your previous response worked.  I just needed to make some alterations to my stored procedure.  Thank you again. 

Page 1 of 1 (6 items)