Coolite handler调用用户控件里的方法

如果是调用用户自定义控件里的方法,方式和母版页相差不大,不同的是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 >    

 

 

你可能感兴趣的:(handler)