Home > Database > Mysql Tutorial > body text

关于微软AjaxPro.2.dll使用的简单例子(.Net v4)

WBOY
Release: 2016-06-07 15:00:17
Original
1039 people have browsed it

第一步:先引用AjaxPro.2.dll 第二步:在web.config里添加如下行: system.web httpHandlers add path=ajaxpro/*.ashx verb=POST,GET type=AjaxPro.AjaxHandlerFactory, AjaxPro.2/ /httpHandlers /system.web 注意:对于个别情况可能还要加入如下行,注意跟上行

第一步:先引用AjaxPro.2.dll

 

第二步:在web.config里添加如下行:

  

    
      
    

  

 

注意:对于个别情况可能还要加入如下行,注意跟上行所添加的位置不同:

  
    
      
      
    

  

 

第三步:cs文件中开头的public partial类上面添加如下(例子A):

[AjaxPro.AjaxNamespace("AppAjax")]

//添加此行后,在aspx里调用方法只需要"AppAjax.方法名"

//可以忽略此步,如果不加此行,在aspx里调用的方法为页面Inherits的值,即"Inherits值.方法名"

 

第四步:Page_Load类中添加如下行(例子A):

AjaxPro.Utility.RegisterTypeForAjax(this.GetType());

 

第五步:在对于需要调用的public类上行添加[AjaxPro.AjaxMethod](例子A)

 

例子A:

using System;

 

namespace WebApplication2
{
    [AjaxPro.AjaxNamespace("AppAjax")]
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(this.GetType());
        }

 

        [AjaxPro.AjaxMethod]
        public string s(string a)
        {
            return a + "s";
        }
    }
}

aspx里使用AjaxPro例子:

    CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>

    


    

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template