Microsoft 9GD00001 Computer Accessories User Manual


 
270 Microsoft Visual Studio 2010: A Beginner’s Guide
you can name the View anything you want. If the View you need to display is named
differently than the action method, you can use the following View method overload:
View("SomeOtherViewName", customers);
We want to use a strongly typed View, meaning that you will have IDE support for
referencing the properties of your own object when working in the V
iew. The selected
object is Customer, which is already defined as a LINQ to SQL entity, which is the same
type returned by the call to the GetCustomers method in CustomerRepository.
The purpose of this View is to display a list of customers, so we’ll select List as View
content. This will prepopulate the View with a template for displaying customers. You’ll
be able to modify the screen as you like. Additionally, if you prefer to write your own
code to populate the screen, you can select the Empty option for V
iew content and then
code the View manually yourself. Selecting List is a quick way to get started.
You learned about MasterPages earlier in this chapter, and you have the option of
selecting a MasterPage of your choice and specifying which ContentPlaceHolder your
code will render in.
Click Add to generate the View shown in Listing 9-8.
Figure 9-5 The Add View window