FREE BOOK

Chapter 2: Your First ASP.NET MVC Application

Posted by Packt Publishing Free Book | ASP.NET MVC & JQuery August 12, 2009
This chapter describes the ASP.NET MVC project template that is installed in Visual Studio. A simple application is built, briefly touching on all of the aspects of the ASP.NET MVC framework.

Creating a new view

During the development of the controller action method, creating a corresponding view is very straightforward. To create a new view for the current controller action, right-click somewhere on the method body, and select Add view... from the context menu. The following dialog box will be displayed:

In the Add view dialog box, some options can be specified. First of all, the view name can be modified if required. By default, this name will be the same as the action method name. It's also possible to select a view template, which we will set to Empty. This template can be used to easily create a view-for example, one which shows the details of an employee. You will see a little more about this in Chapter 4, Components in the ASP.NET MVC Framework.

From this dialog, it's also possible to make the view strongly-typed by simply selecting the corresponding checkbox and choosing the class to base the view on. The last option in this dialog box allows you to specify the master page.

Total Pages : 9 56789

comments