This is a migrated thread and some comments may be shown as answers.

How to programmatically scroll to bottom RadGrid client side

3 Answers 407 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rami
Top achievements
Rank 1
Rami asked on 24 Jan 2013, 06:23 AM
How can I scroll to bottom RadGrid from Client side.
Please help

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Jan 2013, 08:06 AM
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.
0
Pavlina
Telerik team
answered on 21 Apr 2015, 01:04 PM
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.

 
0
Akshit
Top achievements
Rank 1
answered on 13 Jun 2016, 11:59 PM

Hi Shinu,

 

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

Tags
General Discussions
Asked by
Rami
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Pavlina
Telerik team
Akshit
Top achievements
Rank 1
Share this question
or