Kendo dropdown data binding

0 Answers 64 Views
DropDownList
Amrendra
Top achievements
Rank 1
Amrendra asked on 01 Aug 2022, 08:29 AM

Hello Team,

I am using one kendo dropdown control inside a form. While submitting the form value is properly binding. But when I am opening an existing form for editing, kendo dropdown is not showing the value which it is fetching from database.

In side view dropdown control---


<input id="AssignedTo" class="form-control" style="width: 250px;" />

 <script type="text/javascript">
        $(document).ready(function () {

   $("#AssignedTo").kendoDropDownList({
                autoBind: false,
                filter: "contains",
                dataTextField: "FullName",
                dataValueField: "StaffID",
                optionLabel: "Search by first or last name",
                dataSource: {
                    serverFiltering: true,
                    pageSize: 80,
                    transport: {
                        read: {
                            url: "/Test/Staff/Search"
                        }
                    }
                },
                value: '@Model.StaffID'
            });
        })

So what is happening right now, when I am editing the form,  the dropdown show "Search by First or last name", but when we expand the options, the expected option is already selected but the dropdown text is not set.

 

Attached the screenshots of the control.

Please provide solution to display the selected value when the form gets loaded.

 

Thanks

Amrendra

Neli
Telerik team
commented on 04 Aug 2022, 06:49 AM

Hi Amrendra,

Could you please try to set the autoBind option to true and check if this will resolve the issue?

- https://docs.telerik.com/kendo-ui/api/javascript/ui/combobox/configuration/autobind

Regards,

Neli

No answers yet. Maybe you can help?

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