Atlas is a Microsoft Ajax project running in the ASP. net2.0 environment.
Atlas home http://www.asp.net/default.aspx? Tabindex = 7 & Tabid = 47
Ajax (Asynchronous JavaScript and XML), combined with. net2.0 functions, is naturally remarkable. Without calling a webpage, you can avoid unnecessary web page cycles, greatly speed up browsing, and reduce the load on the server. In terms of user experience, you can create a rich UI, making expressive web pages is no longer so troublesome.
It is relatively simple to install atlas, as long as there is ASP. Net2.0, and then install it in a Project template file.
Follow the steps of Atlas Quickstart tutorials to start the first test: Call WebService asynchronously.
In the Atlas project:
1: create a simple WebService first Public Class Webservicet1: system. Web. Services. WebService
{
Public Webservicet1 ()
{
}
[Webmethod]
Public String Testmethod ( String MSG)
{< br> system. threading. thread. sleep ( 1000 * 60 * 21 );
return " the WebService got it: " + MSG;
}
}
2: Create An ASPX page
First, add an atlas reference on the page:
Note that the WebService address must be referenced. Fortunately, in 2.0CodeThere are a lot of automated functions. If you can't write too much code by yourself, you will be prompted when you enter a few letters.
< Atlas: scriptmanager ID = " Scriptmanager1 " Runat = " Server " Enablescriptcomponents = ' False ' >
< Services >
< Atlas: servicereference path = ' Webservicet1.asmx ' />
</ Services >
</ Atlas: scriptmanager >
Add two HTML controls to the page: one button and one text box. Double-click the text box to automatically create a client-side event and a JS function.
< Input ID = " Button1 " Type = " Button " Value = " Click me and will invoke the WebService " Onclick = " Return button1_onclick () " />
< ASP: textbox ID = " Textbox1 " Runat = " Server " Ontextchanged = " Textbox1_textchanged " > </ ASP: textbox >
JS Functions
Function button1_onclick ()
{
Webservicet1.testmethod (document. getelementbyid ('Textbox1'). Value, oncomplet, ontimeout );//Asynchronous call: callback function for passing two events: After completion; time-out
Return True;
}
Function oncomplet (result)
{
//Return value. The result is of the objext type and can be passed to an instance of the class, such as able.
Window. Alert (result );
}
Function ontimeout (result)
{
//There are also returned values. I don't know what it is.
Window. Alert ('Time out. Got nothing from the server');
Window. Alert (result );
}
Run the test.
Several questions:
1: The passed type can be a complex type. In addition to strings, it can also be an instance of a class. The return value is also.
Result. Name = xx. The detailed introduction will be available in the "Atlas data bundle" in the future.
2: It seems that the WebService method must have a parameter.
3: There can also be no ontimeout processing.