or
01.Project:{02.editable:true,03.validation: {04.custom: function(input) {05.if(input.val()=="") {06.input.attr("data-custom-msg", "Message");07.return false;08.}09.else10.return true;11.}12.}13.} $('#groups').kendoDropDownList({ dataSource: [ { text: "No group", value: "none" }, { text: "By type", value: "type_label" }, { text: "By route", value: "route_label" }, { text: "By status", value: "status_label" } ], dataTextField: "text", dataValueField: "value", select: function(e){ var selectedDataItem = this.dataItem(e.item.index()); set_global_setting ("group_state", dataItem.value);// ... code which depends on selectedDataItem and works this.dataSource } }).data("kendoDropDownList").select(function(dataItem){ return dataItem.value === get_global_setting("group_state"); }); var groups_dropdown = $('#groups').data("kendoDropDownList"); groups_dropdown.trigger("select", {item : groups_dropdown.dataItem()}); // does not work since 'select' event expects 'e.item' as 'li'<div style="display: none; position: absolute;" data-role="popup" id="dropdownlist1-list" class="k-list-container k-popup k-group k-reset"><ul aria-live="off" id="dropdownlist1_listbox" aria-hidden="true" role="listbox" tabindex="-1" style="overflow: auto;" unselectable="on" class="k-list k-reset"><div style="width: 700px"> @(Html.Kendo().Grid<RoleGridModel>() .Name("grdRoles") .Columns(columns => { columns.Bound(r => r.Name).Width(200); columns.Bound(r => r.Description).Width(300); columns.Command(command => { if (security.CanAdd || security.CanUpdate) command.Edit(); if (security.CanDelete) command.Destroy(); }).Width(200); }) .Groupable(grouping => grouping .Enabled(false)) .Events(events => { if (security.CanAdd && !security.CanUpdate) events.DataBound("function() { this.table.find('.k-grid-edit').hide(); }"); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(r => r.RoleId)) .Events(events => events.Error("error_handler")) .Read(read => read.Action("Index", "Roles", new { area = "Setup" })) .Create(create => create.Action("Create", "Roles", new { area = "Setup" })) .Update(update => update.Action("Edit", "Roles", new { area = "Setup" })) .Destroy(destroy => destroy.Action("Delete", "Roles", new { area = "Setup" })) .Sort(sort => sort.Add(r => r.Name).Ascending()) .PageSize(10)) .Filterable(filtering => filtering .Enabled(true)) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable(paging => paging .Enabled(true) .Info(true) .PageSizes(false) .Refresh(true)) .Scrollable(scrolling => scrolling .Enabled(false) .Height(400) .Virtual(false)) .Sortable(sorting => sorting .Enabled(true) .AllowUnsort(false) .SortMode(GridSortMode.SingleColumn)) .ToolBar(toolbar => { if (security.CanAdd) toolbar.Create(); }) )</div>[HttpPost]public ActionResult Edit([DataSourceRequest] DataSourceRequest request, RoleGridModel model){ if (ModelState.IsValid && model != null) { try { Role r = Mapper.Map<RoleGridModel, Role>(model); r.AppContext = this.AppContext; r.SubscriberId = this.AppContext.SelectedSubscription.SubscriberId; r.SubscriptionId = this.AppContext.SelectedSubscription.SubscriptionId; r.ModifyDate = DateTime.UtcNow; r.IsNew = false; r.IsMarkedForDelete = false; r.HasChanges = true; r.Save(); } catch (Exception ex) { LogException(ex); ModelState.AddModelError("", "Unable to update role. " + ex.Message); } } return Json(ModelState.ToDataSourceResult());}