Combine Input with Combobox

3 posts, 0 answers
  1. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 20 Oct 2011 Link to this post

    Hi,

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

    Cheers,
    Jani
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Oct 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 21 Oct 2011 Link to this post

    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
Back to Top