Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 603
Aeveus Avatar asked Jul 28 '26 02:07

Aeveus


2 Answers

Kendo does not take the new value unless we trigger the change event for the drop-down list. Once we set the value we have to trigger the change event

var menulist = $("#menulist").data("kendoDropDownList");
menulist.value("Top");
menulist.trigger("change");
like image 187
Harsha pps Avatar answered Jul 30 '26 14:07

Harsha pps


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

like image 33
mast3rd3mon Avatar answered Jul 30 '26 14:07

mast3rd3mon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!