In this video, we'll walk you through setting up an ASP.NET MVC application using a standard Visual Studio Template.
- From File->New project, create a new project using ASP.NET Web Application template.
- In the new ASP.NET Web Application wizard, select MVC and click OK.
- Next, right click References node under Solution Explorer, select Add reference.
- In the Reference Manager, click Browse.
- Go to the bin folder of ASP.Net MVC Edition under Program Files X86/ComponentOne
- Select and add C1.Web.Mvc dll. It is recommended that the Copy Local property for this reference is set to true.
- Next we will add licensing for ComponentOne controls to the project.
- Right Click the Project and select Add text file from context menu.
- Name the file Licenses.licx.
- Enter "C1.Web.Mvc.LicenseDetector, C1.Web.Mvc" to the file.
- Save and close the file.
- Next, open the web.config file under Views folder.
- Add the C1.Web.MVC and C1.Web.Mvc.Fluent namespaces to the pages node under System.web.webpages.razor. This will enable Intellisense for ComponentOne controls.
- Now we need to register the resources i.e. JS, CSS for the controls.
- Open, _Layout.cshtml file under Views/Shared.
- Inside the head tag enter @Html.C1().Styles() to register CSS.
- Add @Html.C1().Scripts().Basic() to register the JavaScript resources.
- Now the project is ready to use any ComponentOne control that is part of C1.Web.Mvc dll.
- Let’s add a control to the Index.cshtml under Views/Home folder to verify the settings.
- Declare a ComponentOne Calendar control using Html Helpers and run the project.
- A functional Calendar is displayed. This verifies that the project is ready to use any ComponentOne control.