1. Is it possible to use a model for the grid definition and another model for the Add/Edit template?
My example:
01.
@(Html.Kendo().Grid<UserDto>()
02.
.Name(
"usersGrid"
)
03.
.Editable(e => e.Enabled(
true
)
04.
.Mode(GridEditMode.PopUp)
05.
.TemplateName(
"EditUser"
)
06.
.AdditionalViewData(
new
{ApiUrl = Model.ApiUrl}))
07.
.DataSource(dataSource =>
08.
dataSource
09.
.Ajax()
10.
.ServerOperation(
true
)
11.
.Model(model =>
12.
{
13.
model.Id(p => p.Id);
14.
model.Field(p => p.Created).Editable(
false
);
15.
})
16.
.Read(read =>
17.
read.Url(Model.ApiUrl +
"/users/get"
)
18.
.Type(HttpVerbs.Get)
19.
)
20.
.Create(acc => acc.Url(Model.ApiUrl +
"/users/create"
)
21.
.Type(HttpVerbs.Post)
22.
)
23.
.Update(acc => acc.Url(Model.ApiUrl +
"/users/update"
)
24.
.Type(HttpVerbs.Put)
25.
)
26.
.Destroy(acc => acc.Url(Model.ApiUrl +
"/users/delete"
)
27.
.Type(HttpVerbs.Post)
28.
)
EditUser.cshtml:
1.
@model CreateUserModel
2.
3.
<input type=
"hidden"
asp-
for
=
"Id"
/>
The reason I'm asking is that the 2 models have different columns, the grid model has more columns, needed for display. The edit model has columns for edit, metadata for edit.
2. Is it possible to attach and send a parameter to the datasource CRUD actions when the action has Url instead of Action name, Controller Name?
1.
.Update(acc => acc.Url(Model.ApiUrl +
"/users/update"
)
2.
.Type(HttpVerbs.Put)
3.
)