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

Combobox Binding

1 Answer 10 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Javor
Top achievements
Rank 1
Javor asked on 29 Aug 2018, 01:05 PM

I have following code 

when I clicked something form combobox and have error and return value to old value in that case the selected item in combobox is the last selected 

01.public class MyClass
02.{
03.    public int ForeignId
04.    {
05.        get
06.        {
07.            return MyObject.ForeignId;
08.        }
09.         
10.        set
11.        {
12.            int oldValue = MyObject.ForeignId;
13.             
14.            try
15.            {
16.                MyObject.No = Helper.Help(value)
17.            }
18.            catch
19.            {
20.                MyObject.ForeignId = oldValue;
21.            }
22.             
23.            OnPropertyChanged(() => ForeignId);
24.        }
25.    }
26.     
27.    public MyObject MyObject{ getset; }
28.}

 

<telerik:RadComboBox ItemsSource="{Binding ItemList}" DisplayMemberPath="Name" SelectedValuePath="ForeignId"
                     SelectedValue="{Binding ForeignId, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}" />

     

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 03 Sep 2018, 09:35 AM
Hello Javor,

Thank you for the provided code. 

I tried to reproduce the described scenario on my side however I was not able to do so. This is why I am attaching the sample project that I used for testing. Please, check it out and see how it differs from the setup at your side. Should you need any further assistance, may I ask you to let me know what you are doing differently or share some steps which I can follow so that I can reproduce the scenario and investigate it further?

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Javor
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or