Hello,
we have some dropdown fields (List<SelectListItem>) for which we would like to show the SelectListItem-Text (instead of Value) in the grid.
The grid is NOT in edit mode.
The column renders as 'undefined':
(Info: if we switch to edit-mode in the grid, the dropdown is working correctly, it's just the display of the Text in the cell that's not working.)
How do we need to configure this?
This ist the List<SelectListItem>:
public class Dropdowns
{
public static List<SelectListItem> Status
{
get
{
return new List<SelectListItem>()
{
new SelectListItem()
{
Text = Resource.ACTIVE,
Value = "Aktiv"
},
new SelectListItem()
{
Text = Resource.DELETED,
Value = "Gelöscht"
},
new SelectListItem()
{
Text = Resource.EXPIRED,
Value = "Ausgelaufen"
}
};
}
}
}
This is the field in the model:
[Required]
[UIHint("STATUSEditor")]
[Display(Name = "STATUS", ResourceType = typeof(Resource))]
public string STATUS { get; set; }
This is the editor template:
@using Kendo.Mvc.UI
@model Models.IDTB_CHARGE
@(
Html.Kendo().DropDownListFor(m => m.STATUS)
.Name("STATUS")
.DataValueField("Value")
.DataTextField("Text")
.ValuePrimitive(true)
.BindTo(Areas.Chargen.Helper.Dropdowns.Status)
)
This is the column in the grid:
columns.Bound(c => c.STATUS).ClientTemplate("#=STATUS.Text#").Width(130);