A simple example of Microsoft AjaxPro.2.dll (. Netv4)

Source: Internet
Author: User
Step 1: first reference AjaxPro.2.dll Step 2. add the following lines in config: system. webhttpHandlersaddpathajaxpro *. ashxverbPOST, GETtypeAjaxPro. ajaxHandlerFactory, AjaxPro.2httpHandlerssystem. web note: in some cases, you may need to add the following lines.

Step 1: first reference AjaxPro.2.dll Step 2. add the following lines in config: system. web httpHandlers add path = ajaxpro /*. ashx verb = POST, GET type = AjaxPro. ajaxHandlerFactory, AjaxPro.2 // httpHandlers/system. web note: in some cases, you may need to add the following lines.

Step 1: first reference AjaxPro.2.dll

Step 2: Add the following lines in web. config:




Note: In some cases, the following rows may be added. Note that the locations are different from those added to the uplink:






Step 3: Add the following (example A) to the public partial class in the cs file ):

[AjaxPro. AjaxNamespace ("AppAjax")]

// After adding this row, you only need to "AppAjax. Method Name" to call the method in aspx"

// Ignore this step. If this line is not added, the method called in aspx is the value of Inherits on the page, that is, "Inherits value. method name"

Step 4: Add the following line to the Page_Load class (Example ):

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

Step 5: Add [AjaxPro. AjaxMethod] (example A) to the upstream of the public class to be called)

Example:

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)
{
Return a + "s ";
}
}
}

Example of using AjaxPro in aspx:

<% @ Page Title = "Homepage" Language = "C #" MasterPageFile = "~ /Site. master"
CodeBehind = "Default. aspx. cs" Inherits = "WebApplication2. _ Default" %>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.