Home > Sample chapters

Working with Data Source Controls and Data-Bound Controls in ASP.NET

Case Scenarios

In the following case scenarios, you apply what you’ve learned in this chapter. If you have difficulty completing this work, review the material in this chapter before beginning the next chapter. You can find answers to these questions in the “Answers” section at the end of this book.

Case Scenario 1: Choosing Data Source Controls

You are a developer at Contoso, Ltd, a car insurance company. You have been asked to write an application that allows a customer service agent to provide an insurance quote to a customer over the phone. However, there are many factors that go into pricing the insurance policy. Each of these factors contains data from different sources. This data is displayed to the agent for selection. Based on his or her selection, a price is generated.

You identify most of the data sources as follows:

  • Location premium markup data Provided as XML from a web service.

  • Year, make, and model rates Provided inside a SQL Server database.

  • Driver history Provided through an XML web service.

  • Existing customer information Provided through a shared customer object to which the application has a reference.

Thinking about how you will access the data, answer the following questions:

  1. Which data source control would you use for accessing the data returned by the location and driver history web services? How would you configure the data source control to receive this data?

  2. Which data source control would you use for accessing the year, make, and model rate data?

  3. How would you access the data provided by the customer object?

Case Scenario 2: Implementing a Master-Detail Solution

You are a developer who is creating a webpage for displaying customers and their orders in a master-detail scenario. The top of the webpage will provide a list of customers that contains the customer numbers and names. The bottom of the webpage will provide a list of the orders containing the order numbers, the order dates, the order amounts, and the ship dates. The orders will be displayed for the customer that is selected.

Thinking about how you will display your data, answer the following questions:

  1. What controls would you use to display the customer and orders?

  2. If you want to use this webpage to add customers and orders, what are some ways that you can provide this functionality?

Case Scenario 3: Adding ASP.NET Dynamic Data to a Website

You are a developer working on an existing website. There are several core tables in the database that users cannot edit. This is becoming a problem, because maintenance is needed. You have been asked to quickly enable this editing for some of these tables not already exposed by the functionality of your website.

Answer the following questions about how you would enable this functionality using Dynamic Data.

  1. How can you add Dynamic Data scaffolding to this existing site?

  2. How would you indicate which tables to expose through Dynamic Data?