开发者

Postback a page based on webmethods result

开发者 https://www.devze.com 2023-03-23 11:54 出处:网络
How can I post back to a page based on result of WebMethod ? function Ass开发者_如何转开发ignmentConditionsSaveAS_Clicked() {

How can I post back to a page based on result of WebMethod ?

 function Ass开发者_如何转开发ignmentConditionsSaveAS_Clicked() {

        var txtConditionName = $('input[id$="txtConditionName"]').val();
        PageMethods.IsExistsSavedCondition(txtConditionName, OnSuccess, OnFailure);
        return false;
    }

    function OnSuccess(result) {
        if (result == 'true') {
            if (confirm('A saved condition with that name already exists. Do you want to overwrite?')) {
                return true;
                // I want to post back the clicked button
                // Can not use __dopostback, because its a control inside a user control                    
            }
            else {
                return false;
            }
        }
        else if (result == 'false') {
            alert('Not Exist');
        }
    }

    function OnFailure(error) {
        alert(error);
    }

OR

How can I do somehting like this:

__doPostBack($('input[id$="btnSaveAS"]'), '');


You just have to do this

__doPostBack($('input[id$="btnSaveAS"]').attr('name'), '');


If I understand you correctly, you just need to get the button and call the click() function to do the post back.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号