Hi, I am new to kendo grid and over all telerik, I am having issues populating the data.
please check the code below. This is the simplest form.
//cshtml view
@using Kendo.Mvc
@using Kendo.Mvc.UI
@model IEnumerable<Database.Station>
@{
ViewBag.Title = "Records";
// foreach(var v in Model)
// {
// var i= v.Componenet;
// }
}
@ViewBag.heading
<hr />
<hr />
@if (Model.Any())
{
<div>
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns => {
columns.Bound(p =>p.ATA).Width(100);
columns.Bound(p => p.Componenet).Width(100);
columns.Bound(p => p.Description).Width(140);
columns.Bound(p => p.DiskNumber);
columns.Bound(p => p.SoftwareNumber).Width(150);
})
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Main", "Station"))
)
)
</div>
}
//controller
public IActionResult Main()
{
var stationList = new List<Station>();
var station = new Station
{
ATA = "22",
SoftwareNumber = "check",
DiskNumber = "1234",
Componenet = "AC",
Description = "Description"
};
stationList.Add(station);
var station2 = new Station
{
ATA = "29",
SoftwareNumber = "check2",
DiskNumber = "1235",
Componenet = "Bike",
Description = "Description"
};
stationList.Add(station2);
return Json(stationList);
}
}
I also noticed following the instruction. it does not tell me to include any css or javascript or any javascript code in script section. so nothing of that natrure is included. Below is the outcome of the nuget. I have no css or other js file from kendo.
And this is what i get