Hello
I'm using a kendo dropdownlistfor() inside a scheduler edit template, if I use just the basic dropdown everything works as expected, but if I try to use the templates for the dropdown all I get is undefined when I click to see the options of the dropdown. If I use the same dropdown directly on the page instead of in a template everything works ok with the dropdown template. Why are they not displaying correct in the scheduler edit template.
So the problem is not with the datasource, I get all values from the db, and the code should be fine since it works directly on the page. I guess the only thing wrong with then code is "data.name" when used inside a template since this gives the undefined. What should it be when used inside a template?
Code:
@(Html.Kendo().DropDownListFor(model => model.equipmentId)
.HtmlAttributes(
new
{ style =
"width: 240px"
, @
class
=
"showOpsDiv"
})
.DataTextField(
"name"
)
.DataValueField(
"id"
)
.OptionLabel(
"Välj Utrustning..."
)
.Value(
"-1"
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetEquipment"
,
"Home"
);
})
.ServerFiltering(
true
);
})
.Template(
"<span class=\"k-state-default\"></span><span class=\"k-state-default\"><h3>#= data.name #</h3></span>"
)
.HtmlAttributes(
new
{ data_value_primitive =
"true"
})
)