Default value after Databounding on DropDownList

0 Answers 80 Views
DropDownList
Maximilian
Top achievements
Rank 1
Maximilian asked on 19 Apr 2022, 07:15 AM

Hi, I need help to set a default value (the value is a filter for my grid) on DropDownList after the databound runs a function.

 

@(Html.Kendo().DropDownList()
                        .Name("gridOptionsDDL")
                        .OptionLabel(@SharedLocalizer[ResourceKeys.NoFilterSelected].Value)
                        .DataTextField("OptionsName")
                        .DataValueField("Id")
                        .AutoBind(false)
                        .Events(e => e.DataBound("loadStandardFilter").Change("onGridOptionsChange").Open("onGridOptionsDDLOpen"))
                        .HtmlAttributes(new { @class = "filter-dropdown" })
                        .DataSource(ds =>
                        {
                            ds.Read(read => read.Action("GetGridOptions", "InventoryData").Data("GetGridOptionsGridName"));
                        })
                        .ToClientTemplate()

 

my js-file:

function loadStandardFilter(e) {
    var dropDownList = $("#gridOptionsDDL").data("kendoDropDownList");;

    dropDownList.select(function (dataItem) {
        return (dataItem.Standard === true);
    })
    dropDownList.trigger("change");
}
Patrick | Technical Support Engineer, Senior
Telerik team
commented on 19 Apr 2022, 06:56 PM

Hi Maximilian,

I noticed there is a duplicate support ticket created by you which addresses the same issue.  Please continue any conversation within the support thread to keep communication in one place.  

Thank you for you understanding in the matter.

Regards,
Patrick | Technical Support Engineer, Senior
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

No answers yet. Maybe you can help?

Tags
DropDownList
Asked by
Maximilian
Top achievements
Rank 1
Share this question
or