Install and test the Ajax for Asp.net plugin

Source: Internet
Author: User
I. Installation

Thanks to the promotion of Google and Yahoo, Ajax has become a new technology for websites.

Ajax is asnychronize JavaScript and XML (Asynchronous JavaScript and XML ). The basic principle is that when a user triggers an event on a webpage, the JavascriptCode(In theory, VBScript can also perform equivalent operations) intercept the event first, and then use the XMLHTTP object in the background to submit the webpage. Partial extraction is required in the returned results to update the webpage. This removes the need to load unchanged controls and reduces user waiting time. In addition, AJAX can easily complete special effects that traditional technologies cannot or are difficult to accomplish, such as the drag operation.

Although Ajax only reassembles existing technologies, it is quite different from traditional programming. Beginners may feel unaccustomed to learning, especially the textbooks that are not yet available. Fortunately, Microsoft ASPCommunityReleased Ajax extender and Ajax control toolkit that can be integrated in Visual Studio 2005. The former provides the core function of Ajax technology, that is, asynchronous submission; the latter is the control set, which contains 32 Ajax controls. I will first introduce how to install Ajax extensionr and Ajax Control Toolkit.

Install. NET Framework 2.0 and Visual Studio 2005.

Microsoft ASP community Ajax download center: [url = http://ajax.asp.net/downloads/default.aspx? Tabid = 47] http://ajax.asp.net/downloads/default.aspx? Tabid = 47 [/url]

In Figure 1, 1 is the download link of the Ajax extender, but it is a pity that the Windows Genuine verification is required. 2. It is the download link of Ajax Control Toolkit. After clicking it, it will point to another web page. There are two download links in the middle of the Web page. One is the full version of 2.2mb, and the other is the MB none.Source code. We recommend that you download the full version. 3 is the demo page of Ajax Control Toolkit.
[Attach] 266232 [/Attach]

Ajax extension is installed by MSIProgram, Follow the prompts. After the installation is complete, the "ajax extensions" group will be found in the control toolbar in. There are five controls. The specific functions will be introduced later. Now you can compile the Ajax program. However, the following steps are required for programming.

Ajax Control Toolkit can only be installed manually. First, decompress the file. Because instance programs are included, we recommend that you decompress the file to a convenient location. Double-click ajaxcontrolextender. VSI In the subdirectory ajaxcontrolextender. 2.
[Attach] 266233 [/Attach]

If vs is installed, run it as prompted. The system prompts that the file may contain harmful code. Open vs, create a group in the control toolbar, and name it "ajax Control Toolkit" (what does not matter). 3 (sorry, I am using the English version of ).
[Attach] 266234 [/Attach]

Right-click the new group and choose "select project" (poor translation), 4.
[Attach] 266235 [/Attach]

In the displayed dialog box, Click Browse, 5.
[Attach] 266236 [/Attach]

Select the ajaxcontroltoolkit. dll file in the samplewebsite/bin subdirectory In the extracted file, and then click exit. 6. In this way, 32 new controls are added to the new group.
[Attach] 268111 [/Attach]

So far, you can run the instances in the Ajax Control Toolkit. Double-click the ajaxcontroltoolkit. sln file in the root directory to open it. If you cannot run the program, download the patch that is attached to this post to overwrite files of the same name in C:/program files/Microsoft Visual Studio 8/XML/schema.
2. Hello world!
After installing Ajax, are you eager to create a program yourself?

I will demonstrate how to make a hello World Program.

First, create a new website. After Ajax is installed, an "ajax Control Toolkit web site" template will be added. The language used for demonstration is C #. Select and confirm. 7.
[Attach] 266239 [/Attach]

Open the design page of a webpage. This should find that there is already a scriptmanager control on the webpage. This is an essential control for every web page that uses Ajax, and there can only be one. Put an update panel (in the Ajax extensions group), two labels, and a button on the webpage, named updatepanel1, label1, label2, button1, and 8 respectively.
[Attach] 266240 [/Attach]

Note that label1 and button1 are in the update panel, while label2 is outside the update panel. Label1.text = "Hello world! ";. To ensure that the webpage is not submitted, enter label2.text = datetime. Now. tostring (); In page_load ();. To reflect the role of the update panel, add label2.text = "This shoshould not be shown to the click event of buton1! ";. 9.
[Attach] 266241 [/Attach]

Run F5. Figure 10 and Figure 11 show the comparison before and after clicking. Note that label2 does not have the update time or long sentence (but the content of label2 will be updated normally on the server side, only because of the existence of the update panel, the update is not displayed on the client. This will be discussed later ).
[Attach] 266242 [/Attach]

[Attach] 266243 [/Attach]

How about Ajax? What are you waiting for? Go on to explore!
 

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.