This topic describes the steps required to add data in the OLAP control using model binding. You can also perform remote data binding in OLAP. For more information about remote data binding, see Remote Data Binding topic.
Complete the following steps to implement model data binding in the OLAP control.
The following image shows how OLAP control appears in the browser after completing the above steps:
Create a new class inside the Models folder to create data source for the OLAP control.
ProductData.cs
). For more information about how to add a new model, see Adding controls.Create a controller and view for OLAP control and follow the below steps to initialize an OLAP control.
Complete the following steps to initialize an OLAP control.
Add a new Controller
OlapController
).OlapController.
Index()
.Razor |
Copy Code
|
---|---|
@model IEnumerable<ProductData> <c1-pivot-engine id="indexEngine"> <c1-items-source source-collection="Model"></c1-items-source> <c1-view-field-collection c1-property="RowFields" items="Country"></c1-view-field-collection> <c1-view-field-collection c1-property="ColumnFields" items="Product"></c1-view-field-collection> <c1-view-field-collection c1-property="ValueFields" items="Sales"></c1-view-field-collection> </c1-pivot-engine> <c1-pivot-panel items-source-id="indexEngine"></c1-pivot-panel> <c1-pivot-chart items-source-id="indexEngine"></c1-pivot-chart> <c1-pivot-grid items-source-id="indexEngine"></c1-pivot-grid> |