Hi,
I am using a combination of Kendo in Razor with WebApi. I have a dropdown which fetches data from a function which is also used to populate a grid. The issue is that the JSON returned by that function has the list in another JSON object which the DropDownList is not able to understand. So the basic question is how to bind a DropDownList() to a remote data which has a list in another object.
Here is my dropdown
@(Html.Kendo().DropDownListFor(m => m.MyData)
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Url("../api/sample/").Type(HttpVerbs.Get);
})
.ServerFiltering(true);
})
.SelectedIndex(0)
)
and the data returned is as following
{"Data":[
{"Id":4,"Name":"alpha"},
{"Id":5,"Name":"beta"}
],
"Total":6,
"AggregateResults":null,
"Errors":null}
Thanks
I am using a combination of Kendo in Razor with WebApi. I have a dropdown which fetches data from a function which is also used to populate a grid. The issue is that the JSON returned by that function has the list in another JSON object which the DropDownList is not able to understand. So the basic question is how to bind a DropDownList() to a remote data which has a list in another object.
Here is my dropdown
@(Html.Kendo().DropDownListFor(m => m.MyData)
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Url("../api/sample/").Type(HttpVerbs.Get);
})
.ServerFiltering(true);
})
.SelectedIndex(0)
)
and the data returned is as following
{"Data":[
{"Id":4,"Name":"alpha"},
{"Id":5,"Name":"beta"}
],
"Total":6,
"AggregateResults":null,
"Errors":null}
Thanks