This article shows how to start writing MVC applications.
Step 1: From the Visual Studio menus select "File" -> "New" -> "Project...".
Step 2: Select the Template web the "ASP.NET MVC 4 Web Application".
Then select the "Empty" template and Razor or ASPX View engine. I chose ASPX here to use ASPX pages for the view.
Now a MVC web application has been added to n the solution.
Step 3: In this step we will add the Controller to our application.
Then just right-click on Controller in the Solution window then "Add" -> "Controller".
Step 5: In the next step we will add the view for our controller. To do that open the HelloWorld controller.
Right-click on the Index action and click on "Add View".
Step 1: From the Visual Studio menus select "File" -> "New" -> "Project...".
Step 2: Select the Template web the "ASP.NET MVC 4 Web Application".
Then select the "Empty" template and Razor or ASPX View engine. I chose ASPX here to use ASPX pages for the view.
Now a MVC web application has been added to n the solution.
Step 3: In this step we will add the Controller to our application.
Then just right-click on Controller in the Solution window then "Add" -> "Controller".
Step 4: Set the name for the controller and add it.
Step 5: In the next step we will add the view for our controller. To do that open the HelloWorld controller.
Right-click on the Index action and click on "Add View".
Do not check the "Use a layout or master page" because we do not have any master page in out application. After adding the view open the source and add your design. I will add one simple line in it, "Hello world! This is my first MVC application".
Final Step: Open the RouteConfig file and set the default Action to open.
Now press F5 and run the application.
Here is the output.
Here is the output.
No comments:
Post a Comment