<a href="http://www.micropoll.com/akira/mpview/585320-168921">Click Here for Poll</a><a href="http://www.questionpro.com" title="online surveys">Online Survey</a><BR> | <a href="http://www.micropoll.com" title="Website Polls">Website Polls</a><BR> | <BR><a href="http://www.micropoll.com/akira/MicroPoll?mode=html&id=168921">View MicroPoll</A></div>

VB.NET and Silverlight!

Read now >

Windows Mobile Development Thoughts

Read now >

ADVERTISEMENT
View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT

 

ADVERTISEMENT
Using AJAX For Rich Web Pages
By Rick Leinecker

Rate This Article: Add This Article To:

Using AJAX For Rich Web Pages - ' AJAX Extensions '
( Page 2 of 3 )

Using the AJAX Extensions

The AJAX extensions re included in Visul Studio 2008. While in Visul Studio 2005 you hd to downlod nd instll them, they re prt of the Visul Studio 2008 instlltion. The AJAX extensions cn be found in the Toolbox in the section lbeled AJAX Extensions s shown in the following figure.

Creting Our First AJAX Web Appliction

It’s time to get strted with AJAX. We’ll crete our first AJAX web site.

To crete new AJAX-enbled Web site, follow these steps:

1. Choose FileÍNew Web Site.

4.Click OK to crete the ASP.NET Web site.

The defult.spx pge opens in Split view.

5. From the AJAX extensions tb of the Toolbox, plce one nd only one ScriptMnger object into the form in the Design view.

Tht’s ll you need to do in order to crete n AJAX-enbled web site. We’ll now spend some time exploring this ppliction by dding nd modifying it to illustrte importnt concepts.

Adding Some Trditionl ASP.NET Controls to the Form

We’ll strt off by dding three lbels nd button to the form. These re trditionl ASP.NET controls. We’ll get these working nd tke look t this simple ppliction first, though, before going on to implement prtil pge updte pttern.

dd the ASP.NET controls,1.2.4.

Using AJAX to Implement Prtil Pge Updte Pttern

Now tht we hve n ASP.NET ppliction working, we’ll use AJAX to implement prtil pge updte pttern. The end result will be tht the button will cuse n updte only for the second lbel.

implement the prtil pge updte pttern,1.2.

Updting Controls From Outside of n UpdtePnel

There might be times when you need to do prtil pge updtes when the control tht fires off the updte cn’t be inside of the UpdtePnel. We’ll modify our ppliction once gin, nd tke the button out of the UpdtePnel. Then, we’ll dd Triggers collection to the UpdtePnel. In the Triggers collection, we’ll specify tht the second lbel should be updted by the button, even though the button is outside of the UpdtePnel.

implement the Triggers collection nd hve button outside of the UpdtePnel cuse n updte,1.2.

4.Click on the Add button, fter which you’ll see tht n AsynPostBck member hs been dded.

5.In the right side of the editor set the controlID to Button1 nd the EventNme to Click. This wires up the buttons click event to the UpdtePnel’s updte.

6.Click on the Add button, fter which you’ll see tht n AsynPostBck member hs been dded.

7.Run the progrm by pressing Ctrl+F5. You’ll see the lbels reflect the time of the first pge lod, then only the second lbel is updted in response to button click even though it’s no longer in the UpdtePnel s shown in the following figure.



 
 
>>> More Using Microsoft Visual Studio Articles          >>> More By Rick Leinecker