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

On Adding Events, DropDownList Becomes A TextBox

1 Answer 329 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Graham
Top achievements
Rank 2
Iron
Iron
Graham asked on 24 Mar 2017, 12:51 PM

The following dropdownlist works fine:

 

    @(Html.Kendo().DropDownList()
            .Name("TrunkDepotsList")
            .HtmlAttributes(new { style = "width: 70px;" })
            .DataTextField("DepotNumber")
            .DataValueField("DepotID")
            .BindTo(Model.DepotList)
            .SelectedIndex(Model.DepotIndex)
    )

 

However - when I add an event handler, it turns into a textbox:

 

    @(Html.Kendo().DropDownList()
            .Name("TrunkDepotsList")
            .HtmlAttributes(new { style = "width: 70px;" })
            .DataTextField("DepotNumber")
            .DataValueField("DepotID")
            .BindTo(Model.DepotList)
            .SelectedIndex(Model.DepotIndex)
            .Events(e =>
            {
                e.Change("refreshTrunkSummaryPage");
            })
    )

 

For reference, here's my event handler script:

 

function refreshTrunkSummaryPage() {
        alert('refresh running');

        ...etc

}

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 28 Mar 2017, 07:50 AM
Hello Graham,

I have tested your implementation and it is correct. Could you check for any js errors in your browser console, because such may cause the incorrect initialization of the DropDown, hence the observed textbox will appear? Make sure that any brackets in the script section of your page are correctly closed.


Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
Graham
Top achievements
Rank 2
Iron
Iron
Answers by
Nencho
Telerik team
Share this question
or