To use ajax.net well, you must learn to use the Ajax Control Toolkit provided by ajax.net flexibly. This control package provides a lot of controls that are very effective, with which you can easily create an Ajax website. From this chapter, we will learn how to use all the controls in the Ajax cotrol toolkit.
Step 1: Create an Ajax toolkit Template
We should be impressed that after we successfully installed the Ajax extension package, an Asp.net Ajax-enabled web site template was added to the vs.net template. It is the official template of Microsoft, and today we will create our own Ajax Control Toolkit web site template.
Download the Ajax Control Toolkit here:Ajax control toolkit.zip
Download the package and decompress it to the local folder. Double-click the ajaxcontroltoolkit. sln file and select "normal project loading ". After you open solution resource manager, you can find many projects, but you only need to regenerate the templatevsi DLL. After the template is generated, the following files will be added to the bin folder of templatevsi.
Double-click ajaxcontrolextender. VSI to install the Ajax Control Toolkit template. Select the rewrite name in the prompt box.
After that, open vs.net 2005 and I will be able to see the Ajax Control Toolkit web site template.
Step 2: Add Ajax Control Toolkit
After the website is created, we cannot see the ajax.net toolset in the toolbar. We need to add it ourselves. Add a tab in the toolbar and name it Ajax Control Toolkit or another name you like. Right-click the new tab and choose "select items"> "Browse"> Find the folder you just decompressed, and find the ajaxcontroltoolkit in the bin folder of samplewebsite. DLL, select it, and then click OK. In this way, you can add all the controls to the tab you added.
Step 3: get started with Ajax Control Toolkit
So far, Ajax Control Toolkit has been deployed. We can make a simple demo to see the effect.
Drag a button control, a Textbox Control, and a label control in the toolbar. Then label1.text = textbox1.text is written in the button click event. When we click the button, the label will display the content in the textbox.
Now, we drag a confirmbuttonextender control from the Ajax Control Toolkit. Its function is to pop up the confirmation window. Click OK to continue the next operation. Otherwise, the operation is terminated.
After dragging out, we need to set the targetcontrolid attribute of confirmbuttonextender. It is associated with the control ID and tells confirmbuttonextender when to bring up a confirmation window. Select button1 from the drop-down menu of this attribute.
Then we also need to set a prompt for the confirmation window. This attribute is in the extenders column of the button. We find contirmtext and enter: Are you sure you want to confirm?
OK, run!
End:
This chapter describes how to deploy the Ajax Control Toolkit and provides a simple example. Although this example can be implemented simply without using Ajax Control Toolkit, I just want to tell you how convenient it is to use Ajax Control Toolkit. In the future, we will introduce other more complex features, more elegant controls, please stay tuned