This is a migrated thread and some comments may be shown as answers.

DropDownList triggered a change event even if i selected a same item

1 Answer 21 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 21 Apr 2021, 04:15 AM

I have a grid using edit Pop-up, the pop-up contain a DropDownList.

The problem is that if i saved two records in the grid. When i open the edit pop-up of the first record and select a new item in the DropDownList then close the pop-up. After that, i open the edit pop-up of the second record and select a same item in the DropDownList (for example, open the pop-up and it bind a selected item "Product1" to the dropdownlist, then i open the dropdownlist and select the "Product1" again). It wrongly triggered the change event. May i know how can i avoid the above problem? Thanks.

cshtml:

01.@(Html.Kendo().DropDownListFor(model => model.Product)
02..Name("EditProduct")
03..DataTextField("ProductName")
04..DataValueField("ProductID")
05..Filter("contains")
06..HtmlAttributes(new
07.{
08.   @class = "form-control",
09.    data_bind = "value: ViewModel.Product, source: ViewModel.ProductList, events: { change: Functions.ProductChanged }",
10.                 data_required_msg = @String.Format(@Error.RequiredField, @Wording.lblProduct),
11.                 required = "required",
12.                 style = "height: 2.9em;",
13.                 @tabindex = 1
14.})
15.)

 

 

Javascript:

1.self.PageModel = new kendo.data.ObservableObject(self.PageModel);
2.kendo.bind(publicAccess.Container(), self.PageModel);

 

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 23 Apr 2021, 09:42 AM

Hi Dennis,

I tested the DropDownList on its own and it does not fire the change event when selected the already selected item. Can you provide a locally runnable solution so that I can examine the exact setup of the custom popup editor and investigate the scenario? 

Regards,
Ianko
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/.

Tags
DropDownList
Asked by
Dennis
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or