The simple application of Ajax in VS2005

Source: Internet
Author: User
Tags add return string
Ajax


Ajax not to mention that we all understand, do not understand please Baidu or goo someone else than I said the professional, the author of this article is not to introduce much abstruse things, This is just a very simple example to guide everyone. This example is only to make it clear that the basic invocation of Ajax needs to do those things the author uses the VS2005 reference AJAX2.0 Assembly (Ajaxpro.2.dll).

In the Web.config file, <system.web> add the following settings




3. Create a page default.aspx

4. Register the name of the Ajax callable class in the Page_Load of the Default.aspx.cs file

protected void Page_Load (object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax (typeof (_default));
}

5. Create Ajax-Callable methods:

[Ajaxpro.ajaxmethod]
public string SETTB (string name)
{
return name;
}

Note: [Ajaxpro.ajaxmethod] is the method that defines the Ajaxpro callable, and it must be noted

6. Front Code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= " Default.aspx.cs "inherits=" _default "%>

"! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">



Untitled page










Note: This is noteworthy here is _DEFAULT.SETTB (name,callback), this sentence is to invoke the _default.aspx.cs background code SETTB this method, If this method has no parameters to pass, indicate the return processing method is OK, written _DEFAULT.SETTB (callback);

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.