or
I have put the page and controller code in an older project (v2012.2.913) and the first two issues disappear.
The grid definition is:-
<div style="font-size:small;width:700px; margin-bottom:15px;">@(Html.Kendo().Grid<PMS2Monitor.Models.SystemSetting>().Name("settingsGrid").Columns(columns=> {columns.Bound(p=>p.SettingCode); columns.Bound(p => p.SettingDescription).Title("Description"); columns.Bound(p => p.SettingValue).Title("Value"); columns.Command(command => { command.Edit(); }); }) .Editable(editable=>editable .Mode(GridEditMode.InLine)) .Pageable() .Filterable() .DataSource(dataSource=>dataSource .Ajax() .Model(m=>m.Id(p=>p.SettingCode)) .PageSize(8) .Events(events => events.Error("error")) .Read(read=>read.Action("InterfaceSettings","Home")) .Update(update=>update.Action("UpdateSetting","Home")) ) ) </div>The object meta data is defined as:-
[MetadataType(typeof(SystemSettingMD))] public partial class SystemSetting { public class SystemSettingMD { [ReadOnly(true)] public object SettingCode { get; set; } [ReadOnly(true), StringLength(50)] public object SettingDescription { get; set; } [StringLength(500), Required] public object SettingValue { get; set; } } }The controller is:-
public ActionResult InterfaceSettings([DataSourceRequest] DataSourceRequest request) { var query = _repository.GetSettings(); query = query.OrderByDescending(c => c.SettingCode); return Json(query.ToDataSourceResult(request)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateSetting([DataSourceRequest] DataSourceRequest request, Models.SystemSetting setting) { try { _repository.updateSetting(setting); return Json(ModelState.ToDataSourceResult()); } catch (Exception ex) { ModelState.AddModelError("ERR1", ex.Message); return Json(ModelState.ToDataSourceResult()); } }I've attached a screenshot of the grid buttons.
Thanks
return Json(ModelState.IsValid ? new object(): ModelState.ToDataSourceResult());@{ Html.Kendo().Window() .Name("popupwindow") .Title("Title Of Window") .Draggable() .LoadContentFrom("MyAction","MyController") .Draggable(true) .Width(800) .Modal(true) .Scrollable(true) .Visible(false) .Render();}@( Html.Kendo().Grid<MyProject.ViewModels.MyObject>() .Name("MyGrid") .Columns(col => { col.Bound(p => p.ID); col.Bound(p => p.SomeField); col.ForeignKey(p => p.SomeOtherID,(System.Collections.IEnumerable)ViewBag.ListOptions, "Value", "Text"); }) .Editable(edit => edit.Mode(GridEditMode.InCell)) .Scrollable() .DataSource(ds => ds.Ajax() .ServerOperation(false) .Model(model => { model.Id(p => p.ID); model.Field(p => p.SomeOtherID).DefaultValue(0); }) .Read("_Read", "MyController") .Update("_Update", "MyController") ) .ToolBar(tool => {
// Removed for this post })) <div class="row-fluid"> <div class="span3"> CID <input class="input-small" type="text" id="cid"> </div> <div class="span3"> <button type="button" id="Search" class="btn btn-primary btn-small">Search</button> <button type="button" id="Reset" class="btn btn-small">Reset</button> </div> </div> <div class="span12"> @(Html.Kendo().Grid(Model).Name("grid").Columns(columns => { columns.Bound(p => p.CopyComment) .Title("Copy") .ClientTemplate("<input type='checkbox' #= CopyComment ? checked='checked': '' # class='chkbx' />") .HtmlAttributes(new { style = "text-align: center" }) .Width(50); columns.Bound(p => p.CID); columns.Bound(p => p.Surname); columns.Bound(p => p.Suburb); columns.Bound(p => p.FID); columns.Bound(p => p.CommentDate); columns.Bound(p => p.SalesClerk); columns.Bound(p => p.Comments); columns.Bound(p => p.Village); columns.Bound(p => p.CommentClass); columns.Bound(p => p.UnitNo); columns.Bound(p => p.ActivityTypeName); columns.Bound(p => p.ActivityMethodName); columns.Bound(p => p.HeardAbout); columns.Bound(p => p.NewspaperName); columns.Bound(p => p.CampaignName); }).Sortable() .Scrollable(scr => scr.Height(400)) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("GetSalesComments", "CopySalesComments") ) )) </div>public ActionResult GetSalesComments(int? cid) {//Do search here and return result return Json(...); }