Preliminary Ajax exercises

Source: Internet
Author: User

Slave Http://ajax.net/ Download a compressed package. Txt Of Quick Usage Guide And one Doc Of Ajax. Net wrapper Usage Guide And DLL .

Well, look.TxtFirst. Learn aboutAjaxSteps for development:

1. Create a reference in the projectAjax. dllReference.

Ii. ModificationWeb. configFile, add

<Httphandlers>

 

<Add Verb= "Post, get" Path=" Ajax/*. ashx" Type= "Ajax. pagehandlerfactory, Ajax" />

 

</Httphandlers>

 

3.Page_loadAdd the following to the event:Code:

 

Ajax. Utility. registertypeforajax (Typeof(Webform1 ));

 

Here, the page can be usedAjax.

 

 

You can write a function in the background code and call it on the client. For example:

 

[Ajax. ajaxmethod ()]

 

Public IntServersideadd (IntFirstnumber,IntSecondnumber)

 

{

 

ReturnFirstnumber + secondnumber;

 

}

 

Here[Ajax. ajaxmethod ()]This sentence must be added. Otherwise, there is no way to use it on the client.

 

In this way, you can directly use thisServersideaddMethod. For example:

Function Add2 ()

{

 VaR Re = webform1.serversideadd (form1.first. Value, form1.second. value)

Form1.result. value = Re. value;

}

 

You can see inJS, This server method was followed byWebform1This is the class name corresponding to the page.

Txt The example in this document is just for your preliminary understanding. Ajax Of course, there are more powerful functions. As a method used by the client, the return value can not only be common, such Int , String This type can also return Dataset And Class Such a complex type is also the "strong" of the Client Javascript "Provides the possibility that developers can perform" Object-Oriented "development on the interface.

at the same time, Ajax refresh is also one of its highlights. Famous component componentart New 3 . 0 product, call-back components. If you are interested, try them.

from: http://www.shpan.com/Detail.asp? Id = 378

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.