08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

266<br />

CHAPTER 11 ■ <strong>AJAX</strong> APPLICATIONS AND EMPOWERING THE WEB USER EXPERIENCE<br />

Figure 11-5. Using a mapping application<br />

Implementing forward caching using Ajax is pretty straightforward. This example will<br />

step you through how to do it by building a browser for the product photos in the AdventureWorks<br />

database. It will show one picture, <strong>and</strong> give you browse buttons that allow you<br />

to look at the next <strong>and</strong> previous pictures in the set.<br />

You’ll build a server page that pulls a picture based on a parameter from the AdventureWorks<br />

database, <strong>and</strong> tie the Ajax front end up to it.<br />

Building the Image Server<br />

The image server fronts the AdventureWorks database. If you don’t have it already<br />

installed on your machine, look back to Chapter 4 for a walk-through.<br />

The image server will be a simple web form application that takes in a parameter,<br />

queries the database for the image with the corresponding ID, <strong>and</strong> writes the image back<br />

to the response when it finds one.<br />

Unfortunately, AdventureWorks doesn’t have a contiguous set of images, so you’ll get<br />

a lot of broken links in your application. For example, there is an image corresponding to

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!