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

Template textbox not excepting spaces

2 Answers 80 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Ben Thies
Top achievements
Rank 1
Ben Thies asked on 13 Aug 2009, 06:48 AM
I have setup a RadListBox (Q2 2009 3.5) with an ItemTemplate.  The template contains a regular textbox control (among other controls). The textbox control however does not do anything when the spacebar is pressed in it.  All other keys appear to work fine.

Is this a known issue, and is there a way around this!?

Thanks,

Ben.

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 13 Aug 2009, 12:51 PM
Hi Ben Thies,

To make it work you need to override one of the private methods of the RadListBox client object - please add the following script after the RadListBox declaration:

<script type="text/javascript"
var keyDown = Telerik.Web.UI.RadListBox.prototype._onKeyDown; 
 
Telerik.Web.UI.RadListBox.prototype._onKeyDown = function(e) { 
    if (e.keyCode == Sys.UI.Key.space) { 
        return
    } 
    else { 
        keyDown.apply(this, arguments); 
    } 
</script> 

I hope this helps.

Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ben Thies
Top achievements
Rank 1
answered on 13 Aug 2009, 10:28 PM
That should be 'accepting' not 'excepting' in the thread title :)

But yes, your workaround has done the trick!

Many thanks.
Tags
ListBox
Asked by
Ben Thies
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Ben Thies
Top achievements
Rank 1
Share this question
or