Browse DevX
Sign up for e-mail newsletters from DevX


Whidbey Simplifies Browser Client Script Callbacks : Page 2

In Whidbey, there's a better way to call remote server methods without using postbacks or remote scripting—letting you update information in the browser without redrawing the entire page. Find out how to fetch data from the server using a client call.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Figure 2. E-R Diagram: You can see the tables you need for the sample application and their relationship to one another.
Implementing a Lookup
Assume you have a page that needs to fetch data from three tables: Region, Country, and City (see Figure 2). This is a typical example of the "dependent list" problem. When a user selects a region the application should fill the Country list with countries from that region. Similarly, when the user selects a country, the City list should contain only relevant cities for the selected country. In other words, it's a hierarchy in which each list's contents depends entirely on the user's selection from its "parent" list (see Figure 2).

It's certainly possible to implement this scenario using the normal postback technique, but you'd have to put up with the slow performance of a complete page redraw for each request. Instead, you can provide a better, faster user experience using remote callbacks, because you can maintain all the page layout code, sending only relevant arguments and receiving only the relevant data. Download the sample application that accompanies this article. The included callback.sql script configures a SQL Server or MSDE database with the data. Run that script first (you may need to alter the script for other databases). Then begin your implementation by starting up Visual Studio.NET Whidbey.

To create your project, select the template type "ASP.NET Web Site" (see Figure 3). This creates a page named default.aspx; rename it, if desired.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date