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

Dropdownlist Select Event not recognized

1 Answer 156 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 23 Apr 2013, 08:46 PM
Hi there,

I am continuing to eval the kendo grid for purchase and seeing if I can get it working in my application which is using MVC 4 and kendo 2013.1.319. 

While swapping in the dropdown I am running into an error for only certain records where the Select Event function on the dropdown is not recognized; even though it is present in the javascript. Its weird because it works for most records that visit the details page and once in awhile it breaks and I can't figure out why. Any ideas?

For example:

I am binding this list with a selectlist in the controller and the values are properly set. there is a full list and the Id is there in the list.

//select list on the viewmodel
pvModel.CostCenterList = new SelectList(_setupBiz.GetNonOverheadCostCenters(), "Key", "Value",pvModel.CostCenterId);

I have this DDL on the .cshtml page

                    @(Html.Kendo().DropDownList()
                        .Name("CostCenter")
                        .OptionLabel("Pick a costcenter...")
                        .BindTo(Model.CostCenterList)
                        .Events(e=>e.Select("CostCenterSelect"))
                        )

and this script in my <scripts> section

    function CostCenterSelect(e) {       
        var costCenter = this.dataItem(e.item.index());
        if (costCenter.Value > 0) {
//stuff happens
        }
        else {
//hide a bunch of buttons        }
    };







1 Answer, 1 is accepted

Sort by
0
Accepted
Tim
Top achievements
Rank 1
answered on 24 Apr 2013, 04:37 PM
It turns out there was a bad character in one of the standard input fields on the page. I think this broke Javascript and the dropdown was the first item on the page so when it tried to fire the event it didn't work.

This issue has been resolved.
Tags
DropDownList
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Share this question
or