Scroll to first selected item server-side

3 posts, 0 answers
  1. David
    David avatar
    16 posts
    Member since:
    Jan 2012

    Posted 16 May 2012 Link to this post

    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. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 18 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David avatar
    16 posts
    Member since:
    Jan 2012

    Posted 18 May 2012 Link to this post

    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.
Back to Top