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

Combine Input with Combobox

2 Answers 50 Views
Input
This is a migrated thread and some comments may be shown as answers.
Jani
Top achievements
Rank 1
Jani asked on 20 Oct 2011, 09:57 PM
Hi,

Is it possible to combine an input contol like the RadNumericTextBox with the RadComboBox?

Cheers,
Jani

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Oct 2011, 08:40 AM
Hello Jani,

As far as I know it is not possible to integrate RadNumericTextBox to RadComboBox. I suppose you want to type numbers only in the input area. If so you can handle the keyPress event and can cancel if it is not a number.
javascript:
<script type="text/javascript">
 function pageLoad()
   {
       var combo = $find("<%= RadComboBox1.ClientID %>");
       var input = combo.get_inputDomElement();
       input.onkeydown = onKeyDownHandler;
    }
 function onKeyDownHandler(e)
    {
       if (!e)
           e = window.event;
       var code = e.keyCode || e.which; 
        if (! (code >= 48 && code <= 57))
         {
            e.returnValue = false;
            if (e.preventDefault) {
                e.preventDefault();
         }
    
</script>

Thanks,
Shinu.
0
Jani
Top achievements
Rank 1
answered on 22 Oct 2011, 04:40 AM
Hi Shinu,

Unfortunately this approach is insufficient:
  • missing Clipboard handling
  • no value range check
  • no advanced input (up/down arrow-keys, mouse-wheel)
  • number formatting (patterns, digits, separators...)

Thanks again,
Jani
Tags
Input
Asked by
Jani
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jani
Top achievements
Rank 1
Share this question
or