开发者

Problem with client event on Telerik MVC Combobox

开发者 https://www.devze.com 2023-01-30 17:21 出处:网络
I have the following markup in an MVC 3 Razor view.As is, the ComboBox renders properly, but doesn\'t drop down when I click the dropdown arrow.If I remove the jQuery validate script references that a

I have the following markup in an MVC 3 Razor view. As is, the ComboBox renders properly, but doesn't drop down when I click the dropdown arrow. If I remove the jQuery validate script references that are added to the view by the create view template, all works. What could be wrong here?

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function provinceChanged() {
        var cityCombo = $('#Cities').data('tComboBox');
        cityCombo.loader.showBusy();

        $.get(url, { provinceId: e.value }, function (data) {
            cityCombo.dataBind(data);
            cityComb开发者_运维技巧o.loader.hideBusy();
            cityCombo.enable();
        });
    }
</script>

...

<div class="editor-field">
    @(Html.Telerik().ComboBox()
        .Name("Provinces")
        .SelectedIndex(1)
        .BindTo(new SelectList(Model.ProvinceList, "ProvinceId", "Name"))
        .ClientEvents(events => events.OnChange("provinceChanged"))
    )
</div>

Here is how reference jQuery, in my master layout:

<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Styles/Blueprint/screen.css") rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    @Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.vista.css"))
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
</head>

RESOLVED: I have no idea what else changed, but after putting the jQuery Validate references back just for a code sample, my code now works with them as well.


Check this. You are probably using an older version of jquery.validate.js which conflicts with jQuery.fn.delegate.

0

精彩评论

暂无评论...
验证码 换一张
取 消