2011-07-26 36 views
1

如何根據WebMethod的結果回發到頁面?根據webmethods結果回發頁面

function AssignmentConditionsSaveAS_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

我該怎麼辦服用點是這樣的:

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

或$( '輸入[ID $ = 「btnSaveAS」]')。點擊().... – 2GDev

回答

1

你只需要做到這一點

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

如果我理解正確的話,你只需要拿到按鈕,呼的一下()函數來完成發回。

+0

是啊,你說得對。 – Rauf