Hello,
Since updating to the latest version of UI for MVC, I've been having issues with DropdownListFor. Everything seems to work fine i.e. load the data and displaying it fine when you click on the icon to open the popup. However, when you select a value, the text displayed is [object Object]. I have no idea why this is and I have searched around for a solution to no avail. I would really appreciate some help on this issue. Below is a sample of my code:
@{
Html.Kendo().DropDownListFor(m => m.Centres)
.Name("cboCentres")
.DataTextField("CentreName")
.DataValueField("CentreId")
.OptionLabel(new
{
CentreName = "All",
CentreId = 0
})
.DataSource(ds =>
{
ds.Read(r => r.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Lookup", action = "GetCentres" })).Type(HttpVerbs.Get));
})
.Events(e =>
{
e.Change("cboCentres_SelectedValueChanged");
})
.Value("0")
.Render();
}
Below is my code for getting the data using WebApi:
public async Task<
HttpResponseMessage
> GetCentres() => Request.CreateResponse(HttpStatusCode.OK, await _CentreServices.GetCentres(), Configuration.Formatters.JsonFormatter);
As an aside, another minor issue I am having is with the grid. Despite the grid displaying data, at the bottom right of it, I get the text "No items to display" instead of the previous "5 of 10 items" for example.
Regards