or
function updateReconcileCB(cb) { var grid = $("#Receipts").data("kendoGrid"); var di = grid.dataItem(grid.select()); di.selected = cb.checked;}
@(Html.Kendo().Grid<Reviews.Models.Review>().Name("ReviewGrid").Columns(columns =>{ columns.Bound(p => p.Customer); columns.Bound(p => p.Location); columns.Bound(p => p.Title).ClientTemplate("<strong>#: Title #</strong>"); //This works columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);}).ToolBar(toolbar => toolbar.Create().Text("Ný Skyrsla")) .DetailTemplate(detail => detail.ClientTemplate( Html.Kendo().Grid<Reviews.Models.ReviewCategory>() .Name("ReviewCategory_#=ReviewID#") .Columns(columns => { columns.Bound(o => o.TableNo); columns.Bound(o => o.Category); columns.Bound(o => o.Comment); //columns.Bound(o => o.PerformedDate); // columns.Bound(o => o.Id).ClientTemplate("<img alt='#: Id #' src='" //+ Url.Content("~/Report/ViewPic/") // + "#: Id #' />").Title("Picture"); columns.Bound(o => o.TableNo).ClientTemplate("<strong>#: TableNo #</strong>");//tthis does not work columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Scrollable() .DataSource(dataSource => dataSource .Ajax() .Events(events => { events.Error("error_handler"); }) .Model(model => model.Id(p => p.Id)) .Create(update => update.Action("ReviewCategory_Create", "Home", new { reviewId = "#=ReviewID#" })) .Read(read => read.Action("ReviewCategory_Read", "Home", new { id = "#=ReviewID#" })) .Update(update => update.Action("ReviewCategory_Update", "Home", new { reviewId = "#=ReviewID#" })) .Destroy(update => update.Action("ReviewCategory_Destroy", "Home")) ) .ToHtmlString())).Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Scrollable() .DataSource(dataSource => dataSource .Ajax() .Events(events => { events.Error("error_handler"); }) .Model(model => model.Id(p => p.ReviewID)) .Create(update => update.Action("Review_Create", "Home")) .Read(read => read.Action("Review_Read", "Home")) .Update(update => update.Action("Review_Update", "Home")) .Destroy(update => update.Action("Review_Destroy", "Home")) ))The first clientTemplate works and
#: Title # get bound to Review.Title.
The second clientTemplate does not work, a js error comes , it says can not bind to TableNo. Writing Title instead of Table No will however display the title from Review class. so eventhourgh my grid is bound to ReviewCategory class the clienttemplate is displaying value from Review class.
Is this a bug ?.
Best
Ole
@using Kendo.Mvc.UI@model KendoDropDownTest.Models.TestModel@{ ViewBag.Title = "Kendo Drop Down and Combo Box Test";}<h2>Kendo Drop Down and Combo Box Test</h2>@using (Html.BeginForm()){ @Html.ValidationSummary() <div> @Html.LabelFor(x => x.DropDownValue) @(Html.DropDownListFor(x => x.DropDownValue, Model.Options, "-- Select an Option --")) @Html.ValidationMessageFor(x => x.DropDownValue) </div> <fieldset> <legend>Kendo</legend> <div> @Html.LabelFor(x => x.KendoComboValue) @(Html.Kendo().ComboBoxFor(x => x.KendoComboValue) .BindTo(Model.Options.Select(x => x.Text))) @Html.ValidationMessageFor(x => x.KendoComboValue) </div> <div> @Html.LabelFor(x => x.KendoDropDownValue) @(Html.Kendo().DropDownListFor(x => x.KendoDropDownValue) .OptionLabel("-- Select an Option --") .BindTo(Model.Options)) @Html.ValidationMessageFor(x => x.KendoDropDownValue) </div> </fieldset> <input type="submit" value="Submit" />}public class TestModel{ [Required] public string DropDownValue { get; set; } [Required] public string KendoComboValue { get; set; } [Required] public string KendoDropDownValue { get; set; } public SelectListItem[] Options = new[] { new SelectListItem { Text = "Option 1", Value = "1" }, new SelectListItem { Text = "Option 2", Value = "2" }, new SelectListItem { Text = "Option 3", Value = "3" }, };}