彩票走势图

彩票走势图 > 慧问 > 频道

Kendo ui comboBox的问题[Kendo UI]

发表于2019-05-10 回复:0 查看:3343  |  

我有一个页面使用了Kendoui的combo控件,代码如下:

@(Html.Kendo()
                      .ComboBoxFor(model => model.GenderCode)
                      .Name("GenderCode")
                      .Placeholder("Choose Gender...")
                      .DataTextField("Text")
                      .DataValueField("Value")
                      .BindTo(new List<SelectListItem>()
                             {
                                 new SelectListItem()
                                 {
                                     Text = "Male", Value = "M"
                                 },
                                 new SelectListItem()
                                 {
                                     Text = "Female", Value = "F"
                                 }
                             })
                      .Suggest(true))

但是生成之后变成了这样:

<input data-val="true" data-val-required="Gender Code is required!" id="GenderCode" name="GenderCode" type="text" /><script> jQuery(function(){jQuery("#GenderCode").kendoDropDownList({"dataSource":[{"Text":"Male","Value":"M"},{"Text":"Female","Value":"F"}],"dataTextField":"Text","dataValueField":"Value"});}); </script> <span class="field-validation-valid" data-valmsg-for="GenderCode" data-valmsg-replace="true"></span>

错误"Object [object Object] has no method 'kendoDatePicker'"

于是我去查了一下kendo官网,它的解释是这样的:

JavaScript error that Kendo widgets are unavailable or undefined If jQuery is included
more than once in the page all existing jQuery plugins (including Kendo UI) will be wiped out.
Will also occur if the required Kendo JavaScript files are not included. The following JavaScript
 errors will be thrown (depending on the browser): TypeError: Object # has no method 'kendoGrid'
(in Google Chrome) TypeError: $("#Grid").kendoGrid is not a function (in FireFox) Object doesn't
 support property or method 'kendoGrid' (in Internet Explorer 9+) Object doesn't support this property
or method (in older versions of Internet Explorer)

然后我检查我的bundles,但是又没有发现哪里多了一个jQuery:

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

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

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at //modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

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

        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));

        // The Kendo JavaScript bundle
        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                "~/Scripts/kendo/2013.2.716/kendo.web.min.js", // or kendo.all.min.js if you want to use Kendo UI Web and Kendo UI DataViz
                "~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js"));


        // The Kendo CSS bundle
        bundles.Add(new StyleBundle("~/Content/kendo").Include(
                "~/Content/kendo/2013.2.716/kendo.common.*",
                "~/Content/kendo/2013.2.716/kendo.default.*"));

 

 

0个回答

打破零回复...

回复

登录 慧都网发表评论

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP