.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

ASP.NET MVC - A deeper look

Posted By:Gaurav Arora       Posted Date: April 26, 2009    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  
 

This article is only for learning purpose and to enhance the ASP.Net MVC skills. The A Step Ahead Series   containing few chapters to describe the same.

History

With release of ASP.NET MVC Beta , Microsoft launched tool. Utility to build Model View Controller applications for ASP.NET. This is available at :

1.       ASP.NET MVC Beta .

2.       < a href=http://go.microsoft.com/fwlink/?LinkID=129910>  ASP.NET MVC  Beta  Release.

Introduction

The MVC pattern separates the components of an MVC web application, which allows the more controls of the individual parts of that application.

MVC is a standard design pattern that many developers are familiar with. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks. Other types of Web applications will combine the two approaches; neither approach excludes the other.

MVC pattern separates objects into following three important sections:

·         Model : This section is specially for maintaining data. It is actually where business logic, querying database, database connections etc. implemented.

·         View : Displaying all or some portion of data or probably different view of data. View is responsible for look and feel, sorting, formatting etc.

·         Controllers : They are event handling sections which affect either the model or the view. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values.

The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic.

 

Features of the ASP.NET MVC Framework

The ASP.NET MVC framework provides the following features:

·         Separation of application tasks.

·         This is an extensible framework, easily to be customized.

·         Rigid support with all Asp.Net pages

 

An introductory example:

Before we start learning how to create an MVC application, must need to know what the basic requirements to run the same are:

If you don't own Visual Studio 2008, then you can download a 90 day trial version of Visual Studio 2008 from this website:

http://msdn.microsoft.com/en-us/vs2008/products/cc268305.aspx

 

Alternatively, you can create ASP.NET MVC applications with Visual Web Developer Express 2008. If you decide to use Visual Web Developer Express then you must have Service Pack 1 installed. You can download Visual Web Developer 2008 Express with Service Pack 1 from this website:

 

http://www.microsoft.com/downloads/details.aspx?FamilyId=BDB6391C-05CA-4036-9154-6DF4F6DEBD14&displaylang=en

 

After you install either Visual Studio 2008 or Visual Web Developer 2008, you need to install the ASP.NET MVC framework. You can download the ASP.NET MVC framework from the following website:

http://www.asp.net/mvc/

 

Create a new ASP.NET MVC Application

Now, lets know how to create a new MVC project:

·         Start your Visual Studio2008 : Start ->Programs -> Visual Studio2008

·         On the File menu, click New Project.

·         In the upper-right corner, make sure that .NET Framework 3.5 is selected.

·         Under Project types, expand either Visual Basic or Visual C#, and then click Web [I have opted C#]

·         Under Visual Studio installed templates, select ASP.NET MVC Web Application.

·         In the Name box, enter MVCApplicationStepAhead.

·         In the Location box, enter a name for the project folder.

·         If you want the name of the solution to differ from the project name, enter a name for the solution in the Solution Name box.

·         Select Create directory for solution and click OK

Select Yes, create a unit test project if Unit Test Project dialog box is displayed.

The above creates a new ASP.Net MVC project.

In next article we will explore the above example in more details. 


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend