I can't seem to find documentation that will help me to sort this out. I'm trying to populate a DropDownList with the wrapper:
The ActionResult method seems straight-forward enough:
The roles are retrieved from the data store, and the JSON seems to be getting sent back to the client, but the values show as "undefined" from the dropdownlist.
If I change ActionResult to JsonResult, I get the same result.
If you could give me some hints as to where my mistake is, I'd be grateful.
Thanks much, and regards...
-Zack
@(Html.Kendo().DropDownList() .Name("DropDownListRoles") .DataTextField("RoleName") .DataValueField("Id") .DataSource(datasource => datasource .Read(read => read.Action("GetRoles", "User")) .ServerFiltering(true) ) .SelectedIndex(0) )The ActionResult method seems straight-forward enough:
public ActionResult GetRoles() { var roles = UserService.GetRoles(); return Json(roles.Select(role => new SelectListItem() { Text = role.RoleName, Value = role.Id.ToString() }), JsonRequestBehavior.AllowGet); }The roles are retrieved from the data store, and the JSON seems to be getting sent back to the client, but the values show as "undefined" from the dropdownlist.
If I change ActionResult to JsonResult, I get the same result.
If you could give me some hints as to where my mistake is, I'd be grateful.
Thanks much, and regards...
-Zack