Basic Introduction To ASP.NET - MVC 3 Framework
- First of all, install mvc 3 framework. Download From: http://www.asp.net/mvc/mvc3.
- After installing, Open Microsoft Visual Studio. Goto File and Create a New Project.
- Choose ASP.NET MVC 3 Web Application and choose the Empty Template / Internet Application.
- Now in Solution Explorer, right click the Controllers Folder and add Controller. (Lets name it HomeController). Also add a model in Model Folder (Lets name it HomeModel).
- Open the HomeController.cs and modifiy it as: (include using MvcApplication1.Models)
- Open SQL server and in your database, create a table. Here, infoTable is created as:
- Open the HomeModel.cs and modifiy it as: (include using MvcApplication1.Connection)
- Here, In Connection Folder , DatabaseConnection class method getConnection() returns connection string where you define your connection to your server,database.
- Then add a View by clicking inside public ActionResult Index() method.
- Open Index.cshtml and write the html code.
NOTE:
- Content Folder include all css files and images that are being used by the project.
- Global.asax.cs includes the public static void RegisterRoutes(RouteCollection routes) method where default controller and its view can be set as per required during build.
No comments:
Post a Comment