How to programmatically scroll to bottom RadGrid client side

4 posts, 0 answers
  1. Rami
    Rami avatar
    2 posts
    Member since:
    Dec 2012

    Posted 24 Jan 2013 Link to this post

    How can I scroll to bottom RadGrid from Client side.
    Please help
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Jan 2013 Link to this post

    Hi,

    Please check the following code snippet I tried to set the scroll position at the bottom of the RadGrid.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" DataSourceID="Sqldatasource1">
        <ClientSettings Selecting-AllowRowSelect="true">
            <ClientEvents OnGridCreated="GridCreated" />
            <Scrolling AllowScroll="true" ScrollHeight="300px" UseStaticHeaders="true" />
        </ClientSettings>
    </telerik:RadGrid>

    Javascript:
    <script type="text/javascript">
        function GridCreated(sender, eventArgs) {
            var scrollArea = document.getElementById(sender.get_element().id + "_GridData");
            var length = sender.get_masterTableView().get_dataItems().length;
            var row = sender.get_masterTableView().get_dataItems()[length - 1];
            scrollArea.scrollTop = row.get_element().offsetTop;
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 21 Apr 2015 Link to this post

    Hi,

    Note that in order to set the vertical scroll at the bottom of the Grid in Firefox SaveScrollPosition property should be set to false, otherwise the code provided by Shinu will not work:
    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />

    Regards,
    Pavlina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  5. Akshit
    Akshit avatar
    1 posts
    Member since:
    Feb 2016

    Posted 13 Jun in reply to Shinu Link to this post

    Hi Shinu,

     

    Do you have any idea where I can perform the operation in code behind rather than javascript.

Back to Top