Kendoui dropdownlist binding to a datasource

When setting the datasource of the dropdownlist, make sure the function that provides the list returns a JsonResult. I was having issues because I was binding to a List<item> and then tried IEnumerable<item>.  I had to change the function to return a Json result version of that Ienumerable as follows:

public JsonResult GetJsonGroupList()
return Json(Groups, JsonRequestBehavior.AllowGet);

//Groups is  a List object

The razor syntax is:

.HtmlAttributes(new {style = “width:250px”})
.DataSource(source =>
source.Read(read =>
read.Action(“GetJsonGroupList”, “Goal”);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s