Gridview with ScrollBar

Last post 05-17-2008 4:52 AM by jchandra. 2 replies.

Sort Posts:

  • Gridview with ScrollBar

    05-17-2008, 2:27 AM

    Hi,

    I have gridview with ScrollBar. But I want to display the ScrollBar should be always Down.

    By default Scroll position always UP. Is this possible to display always DOWN?

     

  • Re: Gridview with ScrollBar

    05-17-2008, 4:27 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,522
    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Gridview with ScrollBar

    05-17-2008, 4:52 AM
    Answer
    • Loading...
    • jchandra
    • Joined on 05-15-2008, 5:36 AM
    • Jakarta, Indonesia
    • Posts 197

    I am not too sure on what you mean always DOWN, but if I am correct, you are asking to display the last record (scroll the last record into view) when loaded, yes?

    I am also not sure what GridView you are using since I don't think the standard one comes with a scrollbar.

    But, in general, the way people implement something like that is to wrap the DataGridView inside a container DIV with absolute height and overflow-y css attribute to auto.

    If that's the case, you can stick in a marker at the bottom of the gridview like a link button or just a regular <a name="gridbottom">&nbsp;</a> so your control should look like this:

     

    <div id="gridcontainer" style="width:100%;height:200px;overflow:auto">
    <asp:GridView ID="..." runat="server" ... />
    <a name="gridbottom" id="gridbottom"></a>
    </div>

     during page load client event (windows.onload) just add a script to scroll the gridbottom element into view i.e.

    <script type="text/javascript">
    window.onload = function() {
      document.getElementById("gridbottom").scrollIntoView();
    }
    </script>
     
    Jimmy Chandra
    Blogging at Incoherent Rambling

    Mark this post as Answer if you think it helped you solve the problem.

Page 1 of 1 (3 items)