AutopostBack No behavior on down/up arrow

4 posts, 0 answers
  1. Phil Borland
    Phil Borland avatar
    6 posts
    Member since:
    Jan 2006

    Posted 17 Mar 2011 Link to this post

    I am looking to replace a Standard Asp.net Listbox with a telerik RadListBox but there is inconsistent behavior between the two that is stopping me from achieving this.

    I have an existing asp.net Listbox with AutoPostBack Set to true, which is used for navigation.  Focus is set on this control on page load and users can use the keyboard up and down arrow keys to navigate up and down this Listbox.  Because autopostback is set on this Listbox this causes a postback and the page is refreshed....

    I swapped this control out for a RadListBox control and it works find Apart from:
    Pressing up and down arrows on the keyboard doesnt cause a postback when autopostback is set.

    This means I cant swap the control out as it doesn't match the functionality of the old fashioned listbox control.

    Two Questions:
    1. Am I doing anything wrong, can autopostback be set and can the RADListbox postback on keyboard arrow up and arrow down
    2. If not can this bug be fixed to match standard functionality of the standard Listbox control

    Thanks
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 21 Mar 2011 Link to this post

    Hi Phil Borland,

    Thank you for pointing this issue to us. This is indeed a miss function of RadListBox. I've logged the issue into our bug tracking system and we are ought to implement it for the Q1 Service Pack 1 release. I've also updated your telerik points as a token of gratitude for your involvement.

    Meanwhile, you can use the following code to workaround the problem:

        Sys.Application.add_load(function() {
            var $ = $telerik.$;
            var listBox = $find("RadListBox1");
            var selectedItem = listBox.get_selectedItem();
     
            $(listBox._getGroupElement())
                .bind("keydown", function(e) {
                    if (listBox.get_autoPostBack())
                        listBox.postback({ type: Telerik.Web.UI.ListBoxCommand.SelectedIndexChanged });
                });
     
            if (!listBox._activeItem && selectedItem != null) {
                listBox._activateItem(selectedItem);
                $(listBox._getGroupElement()).focus()
            }
        });
    </script>
     
    <telerik:RadListBox runat="server" ID="RadListBox1" AutoPostBack="true" TabIndex="1">
        <Items>
            <telerik:RadListBoxItem Text="Text1" />
            <telerik:RadListBoxItem Text="Text2" />
            <telerik:RadListBoxItem Text="Text3" />
            <telerik:RadListBoxItem Text="Text4" />
            <telerik:RadListBoxItem Text="Text5" />
            <telerik:RadListBoxItem Text="Text6" />
            <telerik:RadListBoxItem Text="Text7" />
        </Items>
    </telerik:RadListBox>


    All the best,
    Genady Sergeev
    the Telerik team
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Phil Borland
    Phil Borland avatar
    6 posts
    Member since:
    Jan 2006

    Posted 14 Jul 2011 Link to this post

    Any news on this fix and when it will land?  I have just downloaded Q2 2011 and up/down arrows down work with auto postback.  I also tried your fix above and it didn't work for me.  The RadListBox I am using is within a RadSplitter/RadPane.
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 19 Jul 2011 Link to this post

    Hi Phil Borland,

    Unfortunately we didn't manage to implement it for the release, this is why we have postponed the feature for the Q2 Service Pack 1. With respect to the workaround, it should be working, are you receiving any JavaScript errors? If possible, please paste here the structure of your page so that we can test it on our side. It is best If you could open a support ticket and attach the page there.

    Regards,
    Genady Sergeev
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top