Rad list box scrollintoview show item in first

7 posts, 0 answers
  1. vinoth sansar
    vinoth sansar avatar
    33 posts
    Member since:
    May 2010

    Posted 17 Nov 2011 Link to this post

    Dear telerik  team,

                      In Radlistbox contains number of items, Am finding using textbox. using tem.scrollIntoView am achieving scroll the position to change. I need to show as first in the item. Is any script to show item as top. Below coding is am using.
    ASPX
    --------
    <table border="0" cellpadding="0" cellspacing="0">
                 <tr>
            <td>
                       <telerik:RadTextBox ID="txtSelectPgm" TabIndex="1" runat="server" Width="295px" onpaste="filterListBoxPaste()" ClientEvents-OnFocus="focusto" ClientEvents-OnKeyPress="filterListBox" SelectionOnFocus="SelectAll">
                       </telerik:RadTextBox >
                              </td>
                   </tr>
             <tr>
                 <td>
                <telerik:RadListBox ID="lstSelectPgm" TabIndex="4" OnClientSelectedIndexChanged="GetProgramName"
                 runat="server"
                       Width="300px"
                    Height="390px" AutoPostBack="false">
                       </telerik:RadListBox>
              </td>
              </tr>
          </table>
     
    JS:
    ----
     
    function filterListBox(sender, e) {
        var SelectPrgm;
        var list = $find("ctl00_Content_lstSelectPgm");
        SelectPrgm = $find("ctl00_Content_txtSelectPgm");
        if (searchText == "")
            searchText = e.get_keyCharacter();
        else
            searchText = SelectPrgm.get_value() + e.get_keyCharacter();
        var items = list.get_items();   
        for (var i = 0; i < items.get_count(); i++) {
            var item = items.getItem(i);       
            if (item.get_text().toLowerCase().startsWith(searchText.toLowerCase())) {
                item.select();
                item.ensureVisible();
                item.scrollIntoView;           
                break;
            }
        }
        SelectPrgm.set_textBoxValue(searchText);
        setTimeout(filterText, 10);
    }

       
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 22 Nov 2011 Link to this post

    Hello Vinoth,

    Please review the attached project. I changed your code to work as expected.

    Kind regards,
    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. vinoth sansar
    vinoth sansar avatar
    33 posts
    Member since:
    May 2010

    Posted 24 Nov 2011 Link to this post

    Thanks Peter Filipo
  5. vinoth sansar
    vinoth sansar avatar
    33 posts
    Member since:
    May 2010

    Posted 29 Nov 2011 Link to this post

    Hello Peter,

             I cheked your project, But its not working as iam expected.
    pls check the image in attachment. I dont know its possible or not.
  6. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 02 Dec 2011 Link to this post

    Hello Vinoth,

    ScrollIntoView method acts like you want only if the item is not into the visible area of the RadListBox. When the item is into the visible area, the method does not scroll.

    Regards,
    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
  7. vinoth sansar
    vinoth sansar avatar
    33 posts
    Member since:
    May 2010

    Posted 02 Dec 2011 Link to this post

    hello Peter.

       Thank you so much for your response.
        Is there anyway to scroll, When the item is into the visible area.

    thanks,
    vinoth


  8. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 07 Dec 2011 Link to this post

    Hello Vinoth,

    Unfortunately the described scenario is not possible to be achieved.

    Greetings,
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017