I've tried using Ajax Binding (and also ToDataSourceResult Binding) from this article to populate a DropDownList. I copy/pasted the exact code from the article into my solution. The GetProducts method on the controller returns 78 products, yet the DropDownList stays empty.
What am I doing wrong?
Controller
public
JsonResult GetProducts()
{
NorthwindDataContext northwind =
new
NorthwindDataContext();
return
Json(northwind.Products, JsonRequestBehavior.AllowGet);
}
View
@(Html.Kendo().DropDownList()
.Name(
"productDropDownList"
)
.DataTextField(
"ProductName"
)
.DataValueField(
"ProductID"
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetProducts"
,
"Home"
);
})
.ServerFiltering(
true
);
})
.SelectedIndex(0)
)