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:
<head></head>
tags. This step will register all the MVC controls used in your application, except FinancialChart, FlexSheet, MultiRow, FlexViewer, OLAP, TransposedGrid, and TransposedMultiRow controls.
HTML |
Copy Code
|
---|---|
<c1-styles /> <c1-scripts> <c1-basic-scripts /> </c1-scripts> |
_Layout.cshtml.
You can add or remove the controls depending upon your project requirements.
HTML |
Copy Code
|
---|---|
<c1-scripts> <c1-basic-scripts/> <c1-finance-scripts> <c1-flex-sheet-scripts /> <c1-flex-viewer-scripts /> <c1-olap-scripts /> <c1-multi-row-scripts /> <c1-transposed-grid-scripts /> <c1-transposed-multi-row-scripts /> </c1-scripts> |
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. The list of controls which support conditional resource registration is as follows:
For example, the following code registers the conditional resources required to use FlexGrid and FlexChart.
Razor |
Copy Code
|
---|---|
<c1-scripts>
<c1-basic-scripts bundles="Grid, Chart" />
</c1-scripts>
|
Similarly, you can also register the conditional resources required to use CollectionView, Input and Gauge.