Search code examples
kendo-ui-angular2

Programmatically selecting a value in kendo-dropdownlist


It appears to not be possible to programmatically select a specific value in the Kendo DropDownList element. I checked the API, but wasn't able to find something to trigger this.

There is a selectionChange event, but this is triggered by manually selecting a value from the dropdown. I'm interested in programmatically selecting an event; is there any way to do this?


Solution

  • Add the following to the dropdown html tag: (selectionChange)="selectionChange($event)"

    And add the following to your typescript code:

    protected selectionChange(value): void {
        console.log("The current value is: " + value)
    }
    

    To change the selected item from the code behind, use this: http://www.telerik.com/kendo-angular-ui/components/dropdowns/api/DropDownListComponent/#toc-value