2013-02-15 65 views
-1

不工作我使用下面的代码调用C#function.But其做工精细的aspx页面不 用户control.Please帮我解决这个问题。的WebMethod在用户控制

function add_plan() { 
      try { 
       alert('enter'); 
       PageMethods.add_plan_Items(onSucceeded, onFailed); 
      } 
      catch (ex) { 
       alert(ex); 
      } 

     } 

     function CallParametersPageMethod() { 
      try { 
       PageMethods.MyFirstParameterPageMethod("This is a Demo", onSucceeded, onFailed); 
      } 
      catch (ex) { 
       alert(ex); 
      } 
     } 
     function onSucceeded(result, userContext, methodName) { 
      $get('div1').innerHTML = result; 
     } 

     function onFailed(error, userContext, methodName) { 
      alert("An error occurred") 
     } 

回答

0

你必须从控制的代码移动方法隐藏文件(ascx.cs)页面的代码隐藏文件(.aspx.cs)。或者在Web服务中移动该方法。