1. First download the ajaxpro component. And reference ajaxpro. DLL to the website (or project ).
2. modify web. config. In<System. Web>Add the followingCode.
<Configuration>
<System. Web>
<Httphandlers>
<! -- Register the Ajax Handler -->
<Add verb = "post, get" Path = "ajax/*. ashx" type = "Ajax. pagehandlerfactory, Ajax"/>
</Httphandlers>
</System. Web>
</Configuration>
3. Register ajaxpro during the page_load event on the page. For example:
Protected void page_load (Object sender, eventargs E)
{
Ajaxpro. Utility. registertypeforajax (typeof (_ default); // The _ default parameter indicates the page.
Class Name. If it is placed in a namespace, you must enter the complete namespace (for example, namespaces. _ default)
}
4. Create a server method. If you add the [ajaxpro. ajaxmethod] tag to a method,
the method becomes a method that can be called by ajaxpro for shadow.
[ajaxpro. ajaxmethod]
Public String getvalue (int A, int B)
{< br> // This method is used to input two numbers from the client, return to the client after adding computing on the server side.
return convert. tostring (a + B);
}
5. Client call.
<Script language = "JavaScript">
Function getvalue (){
_ Default. getvalue (, getgroups_callback); // call the _ default. getvalue method on the server.
This requires a callback function to receive the client result after the server completes processing.
Form1.textbox1. value = "123 ";
}
// The user accepts and processes the results returned by the server.
Function getgroups_callback (response ){
VaR dt = response. value;
Alert (DT );
}
</SCRIPT>
This is simple, but it is already a complete ajaxpro.
Of course, ajaxpro can provide many more practical and powerful functions. This is just an example. Sort the other files in another day and try again.