I have a REST service that outputs the following json using GET:
My Combobox setup looks like this:
My Controller:
My combobox looks like it is binding to some sort of data, but all items in the list are 'undefined'. What am I doing wrong? I have verified that the controller is receiving the json string just fine from service.
[{"Active":true,"DisplayText":"Flyers","TemplateCategoryID":1},{"Active":true,"DisplayText":"Door Hangers","TemplateCategoryID":2},{"Active":true,"DisplayText":"Postcards","TemplateCategoryID":3},{"Active":true,"DisplayText":"Tri-Fold","TemplateCategoryID":4},{"Active":true,"DisplayText":"Facebook Graphics","TemplateCategoryID":5}]@(Html.Kendo().ComboBox() .Name("templateCat") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget. .DataTextField("DisplayText") //Specifies which property of the Product to be used by the combobox as a text. .DataValueField("TemplateCategoryID") //Specifies which property of the Product to be used by the combobox as a value. .Filter(FilterType.Contains) .DataSource(source => { source.Read(read => { read.Action("GetTemplateCategories", "Console"); //Set the Action and Controller name }); }) .SelectedIndex(0) //Select first item.)public ActionResult GetTemplateCategories(){ string baseAddress = string.Format(ConfigurationManager.AppSettings["MarketingServiceAddress"] + "GetTemplateCategories"); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(baseAddress); request.Method = "GET"; request.ContentType = "text/plain"; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { int statusCode = (int)response.StatusCode; StreamReader reader = new StreamReader(response.GetResponseStream()); string results = reader.ReadToEnd(); return Json(results, JsonRequestBehavior.AllowGet); }}