C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

ASP.NET MVC – A Step Ahead Series : Part-I


Posted Date: 26 Oct 2008    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Gaurav AroraMember Level: Diamond    
Rating: 1 out of 5Points: 10



ASP.NET MVC – A Step Ahead Series : Part-I


This article is only for learning purpose and to enhance the ASP.Net MVC skills. The A Step Ahead Series containing few chpters 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. 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:

  1. Model :

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


  2. View :

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


  3. 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:

  1. Separation of application tasks.

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

  3. 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 are the basic requirements to run the same:
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:

  1. Start your Visual Studio2008 : Start ->Programs -> Visual Studio2008

  2. On the File menu, click New Project.

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

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

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

  6. In the Name box, enter MVCApplicationStepAhead.

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

  8. 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.

  9. 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.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
MVC Framework  .  ASP.NET MVC  .  A Step Ahead Series  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Opening older version of a document in sharepoint
Previous Resource: DropDownList asp.net Control problems and challanges faced using appenddatabound items and autopostb
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use