Version - 2016.3.914
I am experiencing a problem getting DDL with templates to render properly when used in an editor template, from a grid.
Example :
Model
public class WeightUnit{ public byte ID { get; set; } public string Code { get; set; } public string Description { get; set; }}Controller action
public ActionResult WeightUnits_Read([DataSourceRequest]DataSourceRequest request){ IEnumerable<Inflight.ServiceModel.WeightUnit> results = svc.ListWeightUnits(); return Json(results.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);}Code section in View
<div id="weights" class="panel-group" style="padding-left:5px;"> @Html.Label("Unit", new { style = "width:80px;" }) @(Html.Kendo().DropDownList() .Name("WghtUnit_ID") .OptionLabel(Labels.PleaseSelect) .DataSource(source => { source.Custom() .ServerFiltering(false) .Type("aspnetmvc-ajax") .Transport(transport => { transport.Read("WeightUnits_Read", "Utility"); }) .Schema(schema => { schema.Data("Data") .Total("Total"); }); ; }) .DataTextField("Description") .ValueTemplate("#: data.Code # - #: data.Description #") .DataValueField("ID")) </div>Problem
When used in an EditorTemplate for adding/editing a record to a grid, the selected value is rendered as ' - undefined'
The exact same code works perfectly well in a basic view.
Am I doing something wrong ? I assumed that templates could be used in any scenario.
Mike
