﻿// see http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/
function clickButton(e, buttonid) {
    if (e.keyCode == 13) {
        var b = document.getElementById(buttonid);
        if (b) {
            if (typeof (b.click) == 'undefined') {
                b.click = function() {
                    var result = true;
                    if (b.onclick) result = b.onclick();
                    if (typeof (result) == 'undefined' || result) {
                        eval(b.getAttribute('href'));
                    }
                }
            }

            if (typeof (b.click) != "undefined") {
                b.click();
                e.cancelBubble = true;
                if (e.stopPropagation) e.stopPropagation();
                return false;
            }
        }
    }
    return true;
}

