HI, i have create a simple project MVC which contains a grid,
1) Side Razori i have insert a Grid
@{
List<object> cols = new List();
cols.Add(new { field = "RuoCodice", direction = "Ascending" });
}
@(Html.EJS().Grid("DataGrid")
.DataSource(dataManger =>
{
dataManger.Url("/Accessi/GetRuoli")
.UpdateUrl("/Accessi/ModificaRuolo")
.Adaptor("UrlAdaptor");
})
.GridLines(GridLine.Both)
.AllowMultiSorting().AllowSorting().AllowFiltering().FilterSettings(r => r.Type(FilterType.Excel))
.Columns(col =>
{
col.Field("RuoCodice").HeaderText("Codice").Width("120")
.ValidationRules(new { required = true, maxLength = 8 })
.CustomAttributes(new { @class = "wrapped-cell" }).Add();
col.Field("RuoDescrizione").HeaderText("Descrizione").Width("75%").CustomAttributes(new { @class = "wrapped-cell" }).Add();
}).SortSettings(sort => sort.Columns(cols))
.EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(EditMode.Dialog); })
.Toolbar(new List() { "Add", "Edit", "Delete","Update","Cancel" })
.Render()
)
2) Server side popolate the grid from db
public ActionResult GetRuoli()
{
List lista = ToDoRmb.Core.Query.Accessi.CaricaListaRuoli().ToList();
return Json(new { result = lista, count = lista.Count() }, JsonRequestBehavior.AllowGet);
}
The code work OK, the grid is load and show the data.
The problem is the press edit and press the button SAVE, the method Edit is call OK, but the record is empty.