New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

How to handle Backspace presses in RadComboBox when EnableLoadOnDemand and MarkFirstMatch are 'true'

How to

Handle BACKSPACE presses in RadComboBox working in Load On Demand and with MarkFirstMatch set to true.

Description

By default, RadComboBox does handle this case. In some cases, when BACKSPACE is pressed, the last letter of the user-typed text should be deleted and Items should be filtered with the new text. This default behaviour can be seen here.

Solution

Handle the OnClientItemsRequesting and OnClientKeyPressing events as shown below:

JavaScript
var queryText = ""; 
   
function clientItemsRequesting(sender, eventArgs) 
{ 
      queryText = eventArgs.get_text(); 
} 
   
function clientKeyPressing(sender, eventArgs) 
{             
      if (eventArgs.get_domEvent().keyCode == 8) 
      { 
         var newText = queryText.substring(0, queryText.length); 

         sender.set_text(unescape(newText)); 
      } 
} 
In this article
How toDescriptionSolution
Not finding the help you need?
Contact Support