gridview page index change with same page link

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: gridview page index change with same page link

  1. #1
    Join Date
    Jan 2009

    gridview page index change with same page link


    i have a web page with 2 gridviews stacked vertically, something like below.

    |--------------- Gridview 1----------------------jump to GV 2-------------------|




    Back to top

    |--------------------Gridview 2 ---------------------------------- |




    i have setup a same-page link at the top of the page to jump to the 2nd gridview, which works fine. my problem is:

    when there are multiple pages of data returned in gridview2, and the user clicks '2' or '3' to go to the next page of gridview2 results, the page is reloaded and displays from the top.

    question: is there a way to incorporate the same page link on page index change of the gridview? when the user changes pages in gridview2, have the page reload and jump to the named anchor on the page mypage.aspx#gridview2


  2. #2
    Join Date
    Jan 2009

    Smile alternate solution

    well, after more digging, i figured out an alternate way to place the user at the second gridview. in case it will help anyone else:

    added a javascript function to the page source that uses scrollintoview


    <script type="text/javascript">
    function scrollToStu()
    var el = document.getElementById("studentgrid");


    next, in the code behind file, i added a registerStartupScript command in the PageIndexChanging function of the 2nd gridview.

    protected void stugridView_PageIndexChanging(object sender, GridViewPageEventArgs e)


    RegisterStartupScript("scrolling", "<script>scrollToStu()</script>");


  3. #3
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Thanks for posting your solution and welcome to DevX

    Hopefully your post will help someone else with the same or similiar problem.

Similar Threads

  1. Change page title on AJAX site...JS?
    By raindance in forum AJAX
    Replies: 11
    Last Post: 12-17-2008, 06:27 PM
  2. Tabbed page controlling dynamic GridView?
    By diverguy in forum ASP.NET
    Replies: 4
    Last Post: 04-11-2008, 04:54 PM
  3. trying to make a link on an xsl page
    By Usha Dewasthali in forum XML
    Replies: 3
    Last Post: 06-14-2001, 10:39 AM
  4. how to open print dialog box from html page or link or button
    By santosh Kumar Racharla in forum Web
    Replies: 1
    Last Post: 02-14-2001, 05:24 PM
  5. Replies: 0
    Last Post: 08-31-2000, 05:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center