Unable to get basic databainding to work

2 posts, 1 answers
  1. Jim
    Jim avatar
    25 posts
    Member since:
    Mar 2016

    Posted 28 Mar Link to this post

    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();

            }

  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 28 Mar Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top