How to show a specific item in <kendo-dropdownlist> TagHelper

Viewed 30

How can I show a specific item in the dropdownlist based on the Id passed in? This is .Net Core and I am using Kendo TagHelper. Thanks in advance.

<kendo-dropdownlist name="txtDropdown" style="width:100%"
                                    datatextfield="Name"
                                    datavaluefield="Id"                                   
                                    option-label="Select..."                                       
                                    >
                    <datasource type="DataSourceTagHelperType.Ajax">
                        <transport>
                            <read url="@Url.Action("Action", "Controller")" />
                        </transport>
                    </datasource>                          
                </kendo-dropdownlist>
1 Answers

I used Jquery to do this:

var Name = @Model.Id;

$(document).ready(function () {
    $("#txtDropdown").data('kendoDropDownList').value(Name);
});
Related