Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have a kendo dropdown as follows:

.OptionLabel("Select Role")
.HtmlAttributes(new { @style = " float: left; text-align: left; width: 59%;" })
.DataSource(source =>
source.Read(read =>
read.Action("BindRole", "WebUser");

the data is populated using ajax request and the datas are shown also as this:

//this is to bind role when the page is loaded first
           var ddl = $('#ddlRoleID').data("kendoMultiSelect");
               url: "/WebUser/BindRole",
               type: "Post",
               async: true,

               success: function (listItems) {

The controller method is as this:

public JsonResult BindRole()
            using (myEntities ObjEntities = new InternalDashboardEntities())
                var roleList = ObjEntities.WebUserRole.Select(id => new { id.RoleID, id.RoleName }).AsEnumerable()
                                .Select(x => new 
                                    RoleID = x.RoleID,
                                    RoleName = x.RoleName

                return Json(roleList.ToList(), JsonRequestBehavior.AllowGet);

The dropdown is populated but when I do F12, i can see the error saying cannot read setDataSource. Is this issue arising due to incorrect jquery resources listed in layout file or something else. Your help would be appreciated.


What I have tried:

jquery in layout has this strucutre.

<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2016.1.406/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2016.1.406/kendo.aspnetmvc.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900