Mainak Datta

Mainak Datta

  • NA
  • 12
  • 6k

Assigning sql query data values in kendo pivotgrid

Jun 23 2015 7:19 AM
Trying assigning the BrandID and BrandName, these two columns values into kendo mvc pivotgrid. But values are not getting displayed. Where I am doing wrong? Please help.
 
public class HomeController : Controller
{
string commString = "";
public HomeController()
{
FWUtility.connString = "Data Source = DEVELOPER1; Initial Catalog = FR8DemoDB; uid=**; pwd=***;";
}
public ActionResult Index()
{
commString = "select BrandID, BrandName from BrandMaster order by BrandName";
List<BrandMaster> listBrandMaster = FWUtility.GetList<BrandMaster>(FWUtility.GetDataTable(commString));
return View(listBrandMaster);
}
}
public class BrandMaster
{
public string BrandID { get; set; }
public string BrandName { get; set; }
}

This is my controller.
The following is my view.
@using Kendo.Mvc.UI
@using System.Data;
@using KendoPivotGrid.Controllers;
<div>
@(Html.Kendo().PivotGrid<BrandMaster>()
.Name("pivotgrid")
.Configurator("#configurator")
.ColumnWidth(120)
.Height(570)
.DataSource(dataSource => dataSource
.Ajax()
.Transport(transport => transport.Read("Index", "Home"))
.Schema(schema => schema
.Cube(cube => cube
.Dimensions(dimensions =>
{
dimensions
.Add(model => model.BrandName).Caption("All Brands");
})
//.Measures(measures => measures.Add("Brands Count")
.Field(model => model.BrandID)
.AggregateName("count")) ))
.Columns(columns =>
{
columns
.Add("BrandName").Expand(true); })
.Rows(rows => rows.Add("BrandName")
.Expand(true))
//.Measures(measures => measures.Values("Brands Count")) ) )
</div>