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

AutopostBack No behavior on down/up arrow

3 Answers 130 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Phil Borland
Top achievements
Rank 1
Phil Borland asked on 17 Mar 2011, 11:22 AM
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

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 21 Mar 2011, 03:09 PM
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
0
Phil Borland
Top achievements
Rank 1
answered on 14 Jul 2011, 05:12 PM
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.
0
Genady Sergeev
Telerik team
answered on 19 Jul 2011, 02:58 PM
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!

Tags
ListBox
Asked by
Phil Borland
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Phil Borland
Top achievements
Rank 1
Share this question
or