or
01.<script type="text/x-kendo-tmpl" id="edit-watch-template">02. <div class="watch-view k-widget">03. <div class="edit-buttons">04. <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span></a>05. <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span></a>06. </div>07. <dl>08. <dt>Serial number</dt>09. <dd>10. <input type="text" class="k-textbox" data-bind="value:SerialNo" name="SerialNo" required="required" validationMessage="required" />11. <span data-for="SerialNo" class="k-invalid-msg"></span>12. </dd>13. <dt>Patient</dt>14. <dd>15. @*<input type="text" class="k-textbox" data-bind="value:IdPatient" name="IdPatient" required="required" min="1" validationMessage="required" />*@16. @(Html.Kendo().ComboBox()17. .DataSource(source => {18. source.Read(read => {19. read.Action("GetPatients", "Watches");20. })21. .ServerFiltering(true);22. })23. .Name("IdPatient")24. .TemplateId("patient-template")25. .DataTextField("DisplayName").DataValueField("Id")26. .Filter(FilterType.Contains)27. .HtmlAttributes(new Dictionary<string,object>{28. {"data-bind","value:IdPatient"}29. })30. .ToClientTemplate()31. 32. )33. <span data-for="IdPatient" class="k-invalid-msg"></span>34. </dd>35. <dt>Home server</dt>36. <dd>37. @(Html.Kendo().ComboBox()38. .DataSource(source => {39. source.Read(read => {40. read.Action("GetHomeServers", "Watches");41. })42. .ServerFiltering(true);43. })44. 45. .Name("IdHomeServer")46. .TemplateId("home-server-template")47. .DataTextField("DisplayName").DataValueField("Id")48. .Filter(FilterType.Contains)49. .HtmlAttributes(new Dictionary<string,object>{50. {"data-bind","value:IdHomeServer"}51. })52. .ToClientTemplate()53. )54. <span data-for="IdHomeServer" class="k-invalid-msg"></span>55. </dd>56. </dl>57. </div>58.</script>1.var listView = $("#watchesListView").data("kendoListView");2.listView.editTemplate = kendo.template($("#edit-watch-template").html());01.public JsonResult CreateWatch(HomeWatchListItem hw) {02. try {03. uow.HomeWatchesRepository.Add(new HomeWatch {04. HomeServerId = hw.IdHomeServer,05. PatientId = hw.IdPatient,06. SerialNo = hw.SerialNo07. });08. uow.Commit();09. return Json(hw);10. }11. catch (Exception) {12. //TODO: what to return here13. return Json(false);14. }15.}success: function (result) { CarSearchResultsToGrid(result, "carSearchGridResults");}function CarSearchResultsToGrid(result, gridId) { var dataSource = new kendo.data.DataSource({ data: result, pageSize: 10 }); $("#" + gridId).data("kendoGrid").setDataSource(dataSource);}@(Html.Kendo().Grid<CarSearchl>() .Name("carSearchGridResults") .Columns(columns => { columns.Bound(c => c.CarNumber) .Width(60); columns.Bound(c => c.OwnerName) .Width(100); columns.Bound(c => c.Colour) .Width(100); columns.Bound(c => c.FuelType) .Width(80); columns.Bound(c => c.LastServiceDate) .Format("{0:dd/MM/yyyy}") .Width(50); columns.Bound(c => c.ManufacturerName) .Width(80); columns.Command(command => { command.Edit(); command.Custom("Create").Click("PropertyPage.DeleteProperty"); }) .Title("Create New Car Report") .Width(166); }) .Pageable(pageable => pageable .PageSizes(true) .ButtonCount(5)) .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(a => a.CarNumber)) .Update(update => update.Action("Create", "Property")) ) )<div class="k-toolbar k-grid-toolbar"> <a id="addRoleButton" class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new Role</a></div> @(Html.Kendo().ListView<iProjX.Models.RoleModel>(Model.Roles) .Name("rolesListView") .TagName("div") .ClientTemplateId("rolesList") .Editable() .Pageable() .DataSource(dataSource => dataSource .Model(model => { model.Id("RoleId"); model.Field(f => f.ProjectId).DefaultValue(Model.ProjectId); model.Field(f => f.Title); model.Field(f => f.Description);; }) .Events(e => e .Error("rolesListViewData_error") .Change("rolesListViewData_change") .RequestStart("rolesListViewData_requestStart")) .Create(create => create.Action("createRole", "Project")) .Read(read => read.Action("getRoles", "Project", new { projectId = Model.ProjectId })) .Update(update => update.Action("updateRole", "Project")) .PageSize(30) ) .Events(e => e .Change("rolesListView_change") .Edit("rolesListView_edit") .DataBound("rolesListView_databound")) )//View template<script type="text/x-kendo-template" id="rolesList"> <div class="roleView" > <div> ${Title} </div> <div> ${Description} </div> <div class="edit-buttons"> <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span>Edit</a> <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span>Delete</a> </div> </div></script>@model iProjX.Models.RoleModel<div class="roleView" id = "newRoleForm2" > @Html.ValidationSummary(true) @Html.HiddenFor(model => model.ProjectId) @Html.HiddenFor(model => model.RoleId) <div class="editor-label"> @Html.LabelFor(model => model.Title) </div> <div class="editor-field"> @Html.TextBoxFor(model => model.Title, new { style = "width:99%", maxlength = 100 }) <span data-for="Title" class="k-invalid-msg"></span> </div> <div class="editor-label"> @Html.LabelFor(model => model.Description) </div> <div class="editor-field"> @Html.TextAreaFor(model => model.Description, new { style = "width:100%; height:100px"}) <span data-for="Description" class="k-invalid-msg"></span> </div> <div class="edit-buttons"> <a class="k-button k-button-icontext k-update-button" onclick="updateClick()" href="\\#"><spanclass="k-icon k-update"></span>Save</a> <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span>Cancel</a> </d