I'm trying to use an AutoComplete component in the popup editor window for a grid.
Here's the grid code:
@(Html.Kendo().Grid<Contract>(Model.Contracts)
.Name(
"contractGrid"
)
.Columns(columns =>
{
columns.Bound(model => model.Name);
columns.Bound(model => model.StartDate).EditorTemplateName(
"_DatePicker"
).Format(
"{0:dd MMM yyyy}"
);
columns.ForeignKey(model => model.WithdrawalReasonId, Model.AllWithdrawalReasons,
"Id"
,
"Value"
);
columns.Bound(model => model.Country).EditorTemplateName(
"_AutoComplete"
);
columns.Command(command =>
{
command.Edit();
}).Width(172);
})
.Events(e => e.DataBound(
"contractGridEdit"
))
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(
false
)
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.ClinicianId).Editable(
false
).DefaultValue(Model.Id);
})
.Create(update => update.Action(
"ContractCreateAndEdit"
,
"Clinician"
).AddRequestVerificationTokenData())
.Update(update => update.Action(
"ContractCreateAndEdit"
,
"Clinician"
).AddRequestVerificationTokenData())
)
)
Here's the AutoComplete editor template (_AutoComplete.cshtml):
@
using
Kendo.Mvc.UI
@model
object
@(Html.Kendo().AutoComplete()
.Name(
"Country"
)
.Filter(
"startswith"
)
.MinLength(3)
.BindTo(
new
string
[] {
"Albania"
,
"Andorra"
,
"Armenia"
,
"Austria"
,
"Azerbaijan"
,
"Belarus"
,
"Belgium"
}
)
)
I've tried various options for the name of theAutoComplete control but cannot get it to render in the grid popup. What am I missing?
Thanks,
Stuart.