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

Scroll to first selected item server-side

2 Answers 66 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 May 2012, 05:14 PM
I have two RadListBoxes on my page which I populate via a database call server-side.

Selecting an item from listbox1 will select (highlight) certain items in listbox2.  After this is done, I want the first highlighted item in listbox2 to display at the top of the visible area of that listbox, i.e. I want that item to scroll to the top of listbox2.

I'm familiar with the client-side methods "item.ensureVisible()" and "item.scrollIntoView"....but what I need is a server-side version of "ensureVisible()".  Is there a way to do this?  Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 18 May 2012, 09:23 AM
Hi David,

Thank you for contacting Telerik Support.

Straight to the question. RadListBox does not support such server side methods. The only way to do it is at the client side (e.g. on client page load to scroll on the selected item of the RadListBox).

I will be glad to assist you further.

All the best,
Peter Filipov
the Telerik team
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 their blog feed now.
0
David
Top achievements
Rank 1
answered on 18 May 2012, 05:48 PM
Thanks Peter...your suggestion worked.  Added the following in client pageLoad(),

        var item = docTypesListBox.get_selectedItem();
        if (item != null) {
            item.ensureVisible();
        }

...and it scrolls the highlighed item to the top of the visible area.  Just what I needed.
Tags
ListBox
Asked by
David
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
David
Top achievements
Rank 1
Share this question
or