利用jQuery保留C# postback event

// cancel event & store event
function clickFunction(){
    // 取消Event
    window.event.returnValue = false;
    window.event.cancelBubble = true;
    // 儲存Event
    var event = window.event;
    var eventElement = $(window.event.srcElement);
    // restore event & continue event
    function continueEvent(){
        // 恢復Event
        $('#__EVENTTARGET').val(eventElement.attr('name'));
        $('#__EVENTARGUMENT').val('');
        // 執行Postback
        document.forms[0].submit();
    }
}

沒有留言:

橫式廣告