Hi all,
I've got a new Grid question for you guys. I'm using a grid with Ajax Binding. For editing, I want to use a custom editor template. The problem is that the editor window is not opening when clicking on edit in the grid. Here is the code of my grid:
01.
@(Html.Kendo().Grid<
ServiorInventaire.Shared.Models.Dynamic.ColumnDescription
>()
02.
.Name("Columns")
03.
.NoRecords(Language.NoRecords)
04.
.Columns(columns =>
05.
{
06.
columns.Bound(p => p.ColumnName).Title(Language.ColumnsColumnName).Width(250);
07.
columns.Bound(p => p.Type).Title(Language.ColumnsType).Width(250);
08.
columns.Command(command => { command.Edit(); }).Width(250);
09.
})
10.
.ToolBar(toolbar =>
11.
{
12.
toolbar.Create().Text(Language.Create);
13.
})
14.
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ColumnDescription").Window(w => w.Title(Language.ItemsPageTitle)))
15.
.DataSource(dataSource => dataSource
16.
.Ajax()
17.
.Model(m =>
18.
{
19.
m.Id(p => p.ColumnName);
20.
})
21.
.PageSize(20)
22.
.Read(read => read.Action("ReadColumnDescriptions", "Item").Data("getTableName"))
23.
.Create(create => create.Action("EditingPopup_Create", "Grid"))
24.
.Update(update => update.Action("EditingPopup_Update", "Grid"))
25.
)
26.
)
Here is my custom template:
01.
@using Kendo.Mvc.UI;
02.
03.
@model ServiorInventaire.Shared.Models.Dynamic.ColumnDescription
04.
05.
<
div
class
=
"k-edit-label"
>
06.
@Html.LabelFor(model => model.ColumnName)
07.
</
div
>
08.
<
div
class
=
"k-edit-field"
>
09.
@Html.Kendo().TextBoxFor(model => model.ColumnName).HtmlAttributes(new { @class = "k-input" })
10.
</
div
>
11.
12.
<
div
class
=
"k-edit-label"
>
13.
@Html.LabelFor(model => model.Type)
14.
</
div
>
15.
<
div
class
=
"k-edit-field"
>
16.
@Html.Kendo().TextBoxFor(model => model.Type).HtmlAttributes(new { @class = "k-input" })
17.
</
div
>
So you see, there is nothing special in my template and in my grid. Still the window is not opening. If I remove ".TemplateName("ColumnDescription")" to specify a custom template, the default editor template opens without problem. Could anybody help me with this?
Thank you very much,
Sascha