Hi guys,
I'm working with a kendo mvc grid
here it is
and that's my controller
The whole operation works fine, the only issue is that the grid display wrong values...
ex
grid with values (id: 5, name: test, value: test)
if I add a new object (6, trial, trial); the new object is correctly added to the database but the new object appears with the same values as the first one in grid (in this case with 5, test, test...
I attached 2 screenshots to better explain my issue.
Thanks
Fabio
I'm working with a kendo mvc grid
here it is
@(Html.Kendo().Grid<Entity>(Model)
.Name(
"valueGrid"
)
.ToolBar(commands => commands.Create())
.Columns(columns =>
{
columns.Bound(c => c.DOMAINID);
columns.Bound(c => c.CODE);
columns.Bound(c => c.VALUE);
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(
false
)
.Model(m => m.Id(v => v.DOMAINID))
.Update(update => update.Action(
"UpdateValue"
,
"DomainValue"
))
.Create(create => create.Action(
"CreateValue"
,
"DomainValue"
))
.Destroy(
delete
=>
delete
.Action(
"DeleteValue"
,
"DomainValue"
))
)
)
and that's my controller
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult CreateValue([DataSourceRequest] DataSourceRequest request, Value domValue)
{
if
(ModelState.IsValid)
{
db.Values.Add(domValue);
db.SaveChanges();
}
DataSourceResult result = db.Values.Where(v => v.DOMAINID == domValue.DOMAINID).ToDataSourceResult(request, ModelState);
return
Json(result);
}
The whole operation works fine, the only issue is that the grid display wrong values...
ex
grid with values (id: 5, name: test, value: test)
if I add a new object (6, trial, trial); the new object is correctly added to the database but the new object appears with the same values as the first one in grid (in this case with 5, test, test...
I attached 2 screenshots to better explain my issue.
Thanks
Fabio