I'd appreciate any help.
I have a Kendo grid with incell editing mode:
@(Html.Kendo().Grid(Model.ContractCurrencyClauses)
.Name("ContractCurrencyClauses")
.ToolBar(toolbar => { toolbar.Create(); })
.Columns(columns =>
{
columns.Bound(p => p.CLAUSE).ClientTemplate("#= CLAUSE #" +
"<input type='hidden' name='ContractCurrencyClauses[#= index(data)#].CLAUSE' value='#= CLAUSE #' />"
).EditorTemplateName("CurrencyClause");
columns.Command(command => { command.Destroy(); });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource =>
dataSource.Ajax()
.Model(model =>
{
...
})
.ServerOperation(false)
)
)
Index function:
function index(dataItem) {
var data = $("#ContractCurrencyClauses").data("kendoGrid").dataSource.data();
return data.indexOf(dataItem);
}
The column CLAUSE has EditorTemplate:
@model int?
@(Html.Kendo().ComboBoxFor(model=>model).BindTo((SelectList)(new SelectList(context.CurrencyClauses, "CODE", "TITLE", Model))))
The problem is when I select some item from the drop down the index() function receives null, instead how can I bind selected index?