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

Remove a keyboard shortcut

2 Answers 74 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 27 Jul 2010, 08:54 AM
Hi

I couldn't find any information on how to manage the RadListBox's keyboard shortcuts. How can I remove e.g. the "Del"-Shortcut for deleting an item?

Thanks in advance
Best
Roman

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 30 Jul 2010, 09:51 AM
Hi Roman,

I suggest you subscribe to OnClientDeleting event of the listbox:

<telerik:RadListBox ID="lbxGroup" runat="server" Width="350px" TabIndex="1" AccessKey="y"
 AllowDelete="true" OnClientDeleting="clientDeleting">
    <ButtonSettings></ButtonSettings>
    <Items>
        <telerik:RadListBoxItem runat="server" Text="RadListBoxItem1" />
        <telerik:RadListBoxItem runat="server" Text="RadListBoxItem2" />
        <telerik:RadListBoxItem runat="server" Text="RadListBoxItem3" />
    </Items>
    <EmptyMessageTemplate>
        No data
    </EmptyMessageTemplate>
</telerik:RadListBox>

and in its handler cancel the event if the "del" button is clicked:

function clientDeleting(sender, args) {
    if(args.get_domEvent().keyCode == 127)
        args.set_cancel(true);
}

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roman
Top achievements
Rank 1
answered on 02 Aug 2010, 07:27 AM
Hello Yana

I didn't have the idea of using keyCodes, thanks for your answer.

Kind regards
Roman
Tags
ListBox
Asked by
Roman
Top achievements
Rank 1
Answers by
Yana
Telerik team
Roman
Top achievements
Rank 1
Share this question
or