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

Set scroll position inside radwindow

1 Answer 56 Views
Window
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 07 Oct 2013, 02:49 PM
I have a RadWindow that scrolls vertically, since its content is rather long.

Is there a way to set the scroll position inside of the radwindow via javascript? Specifically I want to scroll to the top of the radwindow after a user clicks a button within it.

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 08 Oct 2013, 10:01 AM
Hello James,

You can use the scrollTop property of the element with the scrollbar and the OnClientShow event of the RadWindow to set it to the desired value. It is done in the same manner as with any other div:
<div style="width: 100px; height: 100px; overflow: auto;" id="test">
    <div style="height: 1000px; background: yellow;">
    </div>
</div>
<telerik:RadWindow ID="RadWindow1" runat="server" OnClientShow="OnClientShow" OpenerElementID="Button1">
    <ContentTemplate>
        <div id="mainHolder" style="width: 100%; height: 100%; overflow: auto;">
            <div style="height: 1000px; background: yellow;">
            </div>
        </div>
    </ContentTemplate>
</telerik:RadWindow>
<asp:Button ID="Button1" Text="open the RadWindow" runat="server" />
<script type="text/javascript">
    function OnClientShow(sender, args)
    {
        $telerik.$($get("mainHolder")).scrollTop(200);
    }
 
    function pageLoad()
    {
        $telerik.$("#test").scrollTop(200);
    }
</script>




Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
James
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or