ComponentOne ASP.NET MVC Controls
Registering Resources
Configuring your MVC Application > Registering Resources

When you create a new application using the ComponentOne MVC template, the resources required to use the C1 MVC controls get registered automatically. But, you need to register resources manually in case you want to use any ASP.NET MVC Edition control in an existing application or create a project using standard Visual Studio templates.

Complete the following steps to register the required resources for using ASP.NET MVC Edition controls:

  1. From the Solution Explorer, open the folders Views | Shared.
  2. Double-click _Layout.cshtml to open it.
  3. Add the following code between the <head></head> tags. This step will register all the MVC controls used in your application, except FinancialChart, FlexSheet, MultiRow, FlexViewer and OLAP controls.
    Razor
    Copy Code
    @Html.C1().Styles()
    @Html.C1().Scripts().Basic()
    
  4. (Optional) Replace the above code with the following code in  _Layout.cshtml if you want to use any specific control such as FinancialChart, FlexSheet, MultiRow, FlexViewer and OLAP control in your application. You can add or remove the controls depending upon your project requirements.
    Razor
    Copy Code
    @Html.C1().Styles()
    @Html.C1().Scripts().Basic().Finance().FlexSheet().FlexViewer().Olap().MultiRow()
    

ASP.NET MVC Edition supports conditional resource registration. Wherein, you may register only the resources that you wish to use in your application to keep your application lighter. For example, the following code will register the resources required to use FlexChart and FlexPie.

Razor
Copy Code
@Html.C1().Scripts().Basic(b=>b.Grid().Chart())
Note: If your view is not using _Layout.cshtml, then add the above code to register resources towards the top of your view page.