This is a migrated thread and some comments may be shown as answers.

Unable to get basic databainding to work

1 Answer 134 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 28 Mar 2016, 02:07 PM

There has to be a setup issue somewhere.  I copied and pasted the Kendo dropdown example.

However the dropdown never calls my method in my controller.  It renders on my page(empty).

What am I missing?

  @(Html.Kendo().DropDownList()

                .Name("myMainName")

                .DataTextField("CustomerName")

                .DataValueField("CustomerID")

                .DataSource(s => {

                    s.Read(read =>

                    {

                        read.Action("GetCustomerList", "MyController");

                    })

                })

                .SelectedIndex(0)

 )

 

_Layout

@Scripts.Render("~/bundles/jquery")

@Scripts.Render("~/bundles/kendo")

@Styles.Render("~/bundles/css")

@Styles.Render("~/Content/kendo/css")

 

BundleConfig

    {

        public static void RegisterBundles(BundleCollection bundles)

        {

           

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));

           

 

            bundles.Add(new StyleBundle("~/bundles/css").Include("~/Content/*.css"));

 

            bundles.Add(new ScriptBundle("~/bundles/kendo").Include(

                "~/Scripts/kendo/kendo.all.min.js",

                // "~/Scripts/kendo/kendo.timezones.min.js", // uncomment if using the Scheduler

                "~/Scripts/kendo/kendo.aspnetmvc.min.js"));

 

            bundles.Add(new StyleBundle("~/Content/kendo/css").Include(

                "~/Content/kendo/kendo.common-bootstrap.min.css",

                "~/Content/kendo/kendo.bootstrap.min.css"));

 

            

 

            bundles.IgnoreList.Clear();

        }

1 Answer, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 29 Mar 2016, 03:53 AM
Hi Jim,

Please ensure that the name of the Controller specified in the Read action is correct. Also, check out the following article for a detailed walkthrough on how you can bind the DropDownList widget.



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DropDownList
Asked by
Jim
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or