Asp.net references seven items in the Ajaxpro.net framework

Source: Internet
Author: User

1. To have the AjaxPo.net framework set, click find>

2. Right-click the project name in ASP.net and add the Asp.net folder. Create a Bin folder.

3. Right-click the BIN folder and select Add reference from it. A dialog box will be displayed. Find the specified AjaxPro. dll or AjaxPro.2.dll and add it.

4. Open the WebConfig file. Add the following content to the <system. web> </system. web> node:

Reference content is as follows:
<HttpHandlers>
<Add verb = "POST, GET" path = "ajaxpro/*. ashx" type = "AjaxPro. AjaxHandlerFactory, AjaxPro.2"/>
</HttpHandlers>

NOTE: If AjaxPro. dll is referenced, the last 2 will not be included. For example: AjaxPro. AjaxHandlerFactory, AjaxPro

5. open the file for creating the server method. Here is Default. aspx. Open the background code file: Default. aspx. cs.

Add the following to Page_Load:

Reference content is as follows:
Protected void Page_Load (object sender, EventArgs e)
{
Utility. RegisterTypeForAjax (typeof (_ Default); // Add it for the front-end code to call related methods
}

6. define the methods to be called in js, such:

Reference content is as follows:
[AjaxMethod] // required.
Public DataSet GetAllNews ()
{
NewsPublish wsNP = new NewsPublish ();
Return wsNP. GetAllNews ();
}

7. This can be referenced in front-end JS.

_ Default. GetAllNews (GetAllNews_callback) // _ Default indicates the Class Name of the method. GetAllNews_callback processes the returned data.

Related Article

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.