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

RadComboBox pushing null to SelectedItem/SelectedValue upon load

15 Answers 1375 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
yonadav
Top achievements
Rank 1
yonadav asked on 04 Feb 2010, 07:33 PM
Hi All,

This is another issue we've started encountering only after the move to Q3 SP2 2009 (we were at Q3 2009 yesterday).

If, for example, we've defined a RadComboBox like so:
<telerik:RadComboBox SelectedValue="{Binding Setting}" 
                                  ItemsSource="{Binding PossibleValues,Mode=OneWay}" 
                                  SelectedValuePath="UniqueName" 
                                  DisplayMemberPath="FriendlyName" /> 

And we place a breakpoint in the Setting property's set function (noticed its bound to SelectedValue). Then every time the RadComboBox we get a call to set with a value of null. Similar things happen when binding to SelectedItem.

Oddly enough, we did not have this issue in Q3 2009 (re-tested today).

Any ideas?

Thanks,
yonadav

15 Answers, 1 is accepted

Sort by
0
Tony Mocella
Top achievements
Rank 1
answered on 25 Feb 2010, 07:27 PM
We've noticed the same behavior in our project (also using 2009 Q3 SP2). Is this something that is fixed in the 2010 Q1 release?
0
Valeri Hristov
Telerik team
answered on 27 Feb 2010, 03:05 PM
Hello Tony,

Could you open a new support ticket and send me a simple application that could be used to observe the problem? We will do our best to provide a fix by Q1 2010, that is scheduled in a couple of weeks.

Sincerely yours,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yonadav
Top achievements
Rank 1
answered on 09 Mar 2010, 04:38 PM
Hi Tony,

In the meantime, you can do what we did:

We set up a between the combo box's Tag property  to the value in a OneTime mode, such as:

<telerik:RadComboBox ... Tag="{Binding Something,Mode=OneTime}" />

This saves the inital value there. Then, we hook the combo box's Loaded Event where we copy the value from the Tag to the SelectedValue (or SelectedItem, depending on the case).

HTH,
yonadav
0
Valeri Hristov
Telerik team
answered on 10 Mar 2010, 03:38 PM
Hi,

Did you place RadComboBox inside a RadGridView CellEditTemplate? If you did, the problem is known and will be fixed in the near future. If you didn't a sample application demonstrating the problem would be of great help.

All the best,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tony Mocella
Top achievements
Rank 1
answered on 10 Mar 2010, 03:46 PM
I think the issue in our case was our EntityFramework classes nullifying the values in our objects when the selected-items get changed via a bound-element on the screen.  We'll work through that issue and circle back if we are still having problems.

Thanks for the pointers.
0
yonadav
Top achievements
Rank 1
answered on 10 Mar 2010, 03:49 PM
Hi Valeri,

We've placed it within an editor template of the MindScape WPF Property Grid. I have a feeling it has a similar behavior to the CellEditTemplate...

When will this be corrected?

Thanks,
yonadav
0
Nedyalko Nikolov
Telerik team
answered on 15 Mar 2010, 01:35 PM
Hi yonadav,

The problem comes from the fact that when RadComboBox.ItemsSource is changed (in this case with null) combo box changes its selected index (value) and through binding updates underlying data object (also with null). I think that this is an expected behavior of the RadComboBox.
In our case (RadGridView and CellEditTemplate) the grid control sets RadComboBox.DataContext to null when cell edit is ended which causes the problem.

We've already fixed the issue and fix will be available with the next latest internal build (every Friday).

Unfortunately the fix is within RadGridView domain. So I think that this won't fix your scenario with "MindScape WPF Property Grid".

Don't hesitate to contact us if you have other questions.


All the best,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Simon
Top achievements
Rank 1
answered on 27 Jul 2011, 04:49 AM
We're experiencing the same problem with the latest controls (Version 2011.2.712.1040).
The RadComboBox's SelectedItem is bound to a property on the ViewModel.
However the property on load is being set to Null by the RadComboBox.

Our RadComboBox sits within a ControlTemplate....
<ControlTemplate x:Key="EditAppointmentTemplate"
          TargetType="TelerikSchedule:SchedulerDialog">

...and the RadComboBox sits within a Grid.

When we replace the RadComboBox with a normal ComboBox control - the problem goes away.
Is there a fix for this - we really would like to keep using the Telerik RadComboBox.

Thanks

EDIT----Further to this...
If I open my EditAppointmentTemplate every alternate time it works. I do not select another appointment in between this.
So
Open 1st time  - RadComboBox sets the property to nulll.
Open 2nd time   - RadComboBox gets the property correctly - based on RIA value
Open 3rd time -  - RadComboBox sets the property to nulll.
Open 4th time -   - RadComboBox sets the property correctly - base on RIA value
etc etc


0
Valeri Hristov
Telerik team
answered on 27 Jul 2011, 02:09 PM
Hello Simon,

I would need a sample application in order to provide specific advice. I suppose this thread is about different problem...

Kind regards,
Valeri Hristov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
YYZRichard
Top achievements
Rank 2
answered on 30 Jan 2012, 08:27 PM
Is there any fix schedule for this problem?
I've got the latest version (as of Jan-2012) and I'm still having the same problem.
I cannot set the the selected item.

The combobox is populated successfully, and the properties "SelectedValuePath" and "DisplayValuePath" are pointing to the correct fields.
When I set the value to...
MyRadComboBox.SelectedValue = "2";
... it's still showing as null, eventhough the item exists in the combobox.

0
Valeri Hristov
Telerik team
answered on 03 Feb 2012, 03:05 PM
Hello Richard,

Could you please, send us a simple application that demonstrates the problem? We never received similar feedback as you describe your problem, so I think it would be best to investigate an application in order to determine if this is a bug in RadComboBox, or in your application.

Greetings,
Valeri Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ron
Top achievements
Rank 1
answered on 18 Oct 2012, 04:09 PM
I found a work around that may or may not apply to your situation.  I ran into what looks like the same issue.  I made sure my SelectedValuePath and DisplayValuePath are set correctly.  The combo box is filled with the correct objects and values.  But, If I try to do a two-way binding to the SelectedValue property, a null value is passed by the control and sets the value of the target object to null.  

What I did was create a command that sets the value and passes a commandParameter to the command.  I use the command to set the value of the desired property and use OneWay binding on the SelectedValue to display the selected object in the comboBox.

<telerik:RadComboBox x:Name="rcbLevel1" d:LayoutOverrides="Height" ItemsSource="{Binding InsertEditItem.Level1s, Mode=TwoWay}" SelectedValue="{Binding InsertEditItem.CurrentItem.Level1}"
                                SelectedValuePath="Description" EmptyText="Select a category..." IsEnabled="{Binding InsertEditItem.Level1IsEnabled, Mode=TwoWay}" Command="{Binding InsertEditItem.SetActiveLevel1Command, Mode=OneWay}" CommandParameter="{Binding SelectedItem, ElementName=rcbLevel1}" DisplayMemberPath="Description"  IsEditable="True"/>
0
Cedric
Top achievements
Rank 1
answered on 08 Oct 2013, 11:25 AM
Actually I found this

It appears the issue is coming from wpf Combobox control (which is extended by the radcombobox I suspect) and  you need to do your updates for the selected item BEFORE the itemsource update in you ViewModel file (I know it sounds crazy but it worked for me).
0
Priyanka
Top achievements
Rank 1
answered on 31 Dec 2016, 09:26 AM

Hii everyone,

I am facing some problem in selected index property of RadComboBox. RadComboBox is having value still validation message is showing for entering value and its selected index is -1.

Any solution?

Thanx,

Priyanka

 

0
Ivan Ivanov
Telerik team
answered on 02 Jan 2017, 10:07 AM
Hi,

Can you please provide some more extensive info on the case? Are you setting the SelectedValue, or SelectedIndex? What type of validation is triggered? If no item is successfully selected due to a validation constraint, keeping the old Selectedindex value is expected.

Regards,
Ivan Ivanov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ComboBox
Asked by
yonadav
Top achievements
Rank 1
Answers by
Tony Mocella
Top achievements
Rank 1
Valeri Hristov
Telerik team
yonadav
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Simon
Top achievements
Rank 1
YYZRichard
Top achievements
Rank 2
Ron
Top achievements
Rank 1
Cedric
Top achievements
Rank 1
Priyanka
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or