This is a migrated thread and some comments may be shown as answers.
scrolling to bottom after ajax postback
3 Answers 48 Views
This is a migrated thread and some comments may be shown as answers.
Joshua Gates
Top achievements
Rank 1
Joshua Gates asked on 03 Sep 2009, 06:23 PM
I currently have a listbox being populated from the client side. each time an ajaxfied timer ticks on the server side. I am wanting to always have the listbox scroll or stay scrolled at the bottom. The list box contains a list of messages from the server. and i am wanting the last message to always be visible which when i add it to listbox it is placed at the bottom.

any idea is appreciated

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 04 Sep 2009, 08:47 AM
Hi Joshua Gates,

Here is how to do this - add the following javascript on your aspx page:

<script type="text/javascript"
    Sys.Application.add_load(function() { 
        var list = $find("<%= RadListBox1.ClientID %>"); 
        var lastItem = list.getItem(list.get_items().get_count() - 1); 
        lastItem.scrollIntoView(); 
    }); 
</script> 

Hope this helps.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joshua Gates
Top achievements
Rank 1
answered on 09 Sep 2009, 05:07 PM
that works however is it possible to keep it at the bottom?
 when the page post back it will scroll to the bottom however the user can see the scroll... so is it possible to make the list box always show the bottom item without seeing the listbox scroll to the bottom each time.
0
Veselin Vasilev
Telerik team
answered on 10 Sep 2009, 09:01 AM
Hello Joshua Gates,

I think this is not possible. Why don't you add the latest item on the top and have it selected?

Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Asked by
Joshua Gates
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Joshua Gates
Top achievements
Rank 1
Share this question
or