Panel Default Button is Not Working For Rad Combobox

Suppose I have multiple TextBox and Rad Combobox controls inside a panel and we have set the default button. So when we write something into the TextBox and press Enter, it fires the default button event. If however you select anything inside the Rad Combobox and press Enter then it doesn't fire the default button.


So to make it work, use the following JavaScript code on your page after the ScriptManager:

<script type="text/javascript">

    var $p = Telerik.Web.UI.RadComboBox.prototype;

    var keyDownHandler = $p._onKeyDown;

    $p._onKeyDown = function (e) {

        var oReturnValue = e.returnValue;

        var oPreventDefault = e.preventDefault;

        var keyCode = e.keyCode || e.which;

        if (keyCode === 13)

            e.preventDefault = null;

        keyDownHandler.call(this, e);

        if (keyCode === 13) {

            e.returnValue = oReturnValue;

            e.preventDefault = oPreventDefault;

        }

    };

</script> 

Up Next
    Ebook Download
    View all
    Learn
    View all