Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is the datasource's url correct? If you are using mvc, url should be /controller/view/. ie: <code>url: "/Home/Clienti/"</code></p> <p>--EDIT--</p> <p>Here is a full example, project Url: 'http://localhost:52794/Home/ComboBox'</p> <p>Controller: Home </p> <p>View: ComboBox</p> <p>ComboBox view code:</p> <pre><code>&lt;input id="kendoCboClient" /&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { clientDS = new kendo.data.DataSource({ transport: { read: { url: "/Home/JsonData/", //Note the URL path! dataType: "json" } }, schema: { model: { fields: { EmployeeId: { type: "number" }, name: { type: "string" } } } } }); $("#kendoCboClient").kendoComboBox({ placeholder: "Select a name...", dataTextField: "Name", dataValueField: "EmployeeId", dataSource: clientDS }); }); &lt;/script&gt; </code></pre> <p>Model class:</p> <pre><code>public class Employee { public int EmployeeId { get; set; } public string Name { get; set; } } </code></pre> <p>Controllers:</p> <pre><code>public ActionResult ComboBox() { return View(); } public JsonResult JsonData() { List&lt;Employee&gt; list = new List&lt;Employee&gt;(); Employee employee = new Employee() { EmployeeId = 1, Name = "John Smith" }; list.Add(employee); employee = new Employee() { EmployeeId = 2, Name = "Ted Teller" }; list.Add(employee); return Json(list, JsonRequestBehavior.AllowGet); } </code></pre> <p>-- EDIT --</p> <p>Another way of returning json:</p> <pre><code>public ActionResult JsonData() { List&lt;Employee&gt; list = new List&lt;Employee&gt;(); Employee employee = new Employee() { EmployeeId = 1, Name = "John Smith" }; list.Add(employee); employee = new Employee() { EmployeeId = 2, Name = "Ted Teller" }; list.Add(employee); JavaScriptSerializer serializer = new JavaScriptSerializer(); var output = serializer.Serialize(list); return Content(output); } </code></pre> <p>-- EDIT --</p> <p>One last example of just a plain json string:</p> <pre><code>public ActionResult JsonData() { String employeesJson = "[{\"EmployeeId\":1,\"Name\":\"John Smith\"},{\"EmployeeId\":2,\"Name\":\"Ted Teller\"}]"; return Content(employeesJson); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload