or
function addExtraStylingToGrid() { $(".k-grid > table > tbody > tr").hover( function () { $(this).toggleClass("k-state-hover"); } );};
@(Html.Kendo().TreeView()
.Name("treeview")
.DataSource(dataSource => dataSource
.Read(read => read.Action("ActionTest", "Test"))
.ToClientTemplate()
---------Controller
public JsonResult ActionTest()
{
var x = new List<KendoTreeViewItemModel>
{
new KendoTreeViewItemModel { id = "1", text = "Surname1", hasChildren=true },
new KendoTreeViewItemModel { id = "2", text = "Surname2", hasChildren=true },
};
return Json(x, JsonRequestBehavior.AllowGet);
}
@model List<Common.Models.Brand>@{ ViewBag.Title = "Maintain Brands";}<h2>Maintain Brands</h2>@(Html.Kendo().Grid(Model) .Name("MaintainBrandsGrid") .Columns(columns => { columns.Bound(brand => brand.BrandId).Title("Id"); columns.Bound(brand => brand.BrandName).Title("Brand Name"); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(185); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Scrollable(scr=>scr.Height(430)) .Filterable() .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .ServerOperation(false) .Model( model => model.Id( brand => brand.BrandId)) .Create( create => create.Action("AddBrand", "BrandMaintenance")) .Update( update => update.Action("UpdateBrand", "BrandMaintenance")) .Destroy( delete => delete.Action("RemoveBrand", "BrandMaintenance")) ) )// // POST: /BrandMaintenance/UpdateBrand [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateBrand([DataSourceRequest] DataSourceRequest request, Brand brand) { if (brand != null && ModelState.IsValid) { var bll = new CatalogMaintenanceBll(); bll.UpdateBrand(brand); } return Json(new[] { brand }.ToDataSourceResult(request, ModelState)); }