I have the following dropdownlistfor:
@(Html.Kendo().DropDownListFor(x => x.SelectedInvoicingCompanyId)
.HtmlAttributes(new { @class = "form-control" })
.BindTo(ViewData["allInvoicingCompanies"] as IEnumerable)
.DataTextField("Name")
.DataValueField("Id")
.OptionLabel(new { Name = "Select company", Id = 0 }))
This works fine in another view with the exact same source. However i have this grid with popup edit and a custom popup edit template with this dropdownlist. In this popup edit template the dropdownlist displays as a textbox and the SelectedInvoicingCompanyId number i.e. "1".
When i press the edit button i also get the following error from jQuery:
Uncaught SyntaxError: Invalid or unexpected token
at m (jquery-3.3.1.min.js:2)
at Re (jquery-3.3.1.min.js:2)
at w.fn.init.append (jquery-3.3.1.min.js:2)
at I.fn.init.w.fn.(anonymous function) [as appendTo] (https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js:2:50106)
at init._createPopupEditor (kendo.all.js:58951)
at init.editRow (kendo.all.js:58796)
at HTMLAnchorElement.<anonymous> (kendo.all.js:58532)
at HTMLDivElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLDivElement.y.handle (jquery-3.3.1.min.js:2)
I can not get my head around this. I had it working some time ago, and i think it started acting this way after i updated to 2018.3.1017.
I have other dropdownlistfor in this popup edit template which are working as they should. So it's only this specific dropdownlist that doesn't load as it should.
This is one example of a working dropdownlist in the same view:
@(Html.Kendo().DropDownListFor(x => x.SelectedPMId)
.HtmlAttributes(new { @class = "form-control" })
.BindTo(ViewData["allUsers"] as IEnumerable)
.DataTextField("DisplayName")
.DataValueField("Id")
.OptionLabel("Select User")
.Filter("contains"))