如果是调用用户自定义控件里的方法,方式和母版页相差不大,不同的是UserControl需要设置别名才能成功调用。如下示例:

 

代码
using System;    
using System.Collections.Generic;    
using System.Linq;    
using System.Web;    
using System.Web.UI;    
using System.Web.UI.WebControls;    
using Coolite.Ext.Web;    
   
[AjaxMethodProxyID(IDMode
=AjaxMethodProxyIDMode.Alias,Alias="UC")]    
public partial class uc : System.Web.UI.UserControl    
{    
    
protected void Page_Load(object sender, EventArgs e)    
    {    
   
    }    
   
    [AjaxMethod]    
    
public string UserControlMethod()    
    {    
        
return "我调用了用户控件里面的方法:UserControlMethod()";    
    }    
}   

 

 

 

 

<uc1:uc ID="uc1" runat="server" />    
   
<ext:Button ID="Button2" runat="server" Text="点我吧">    
    
<Listeners>        
    
<Click Handler="      
         Coolite.AjaxMethods.UC.UserControlMethod({      
             success: function(result) {      
                 Ext.Msg.alert(
'提示信息', result);      
             }      
         });
" />        
    </Listeners>        
</ext:Button>   

 

 

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
猜你喜欢
  • 2021-06-07
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案