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

selecting value from code?

1 Answer 72 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gary Blakely
Top achievements
Rank 1
Gary Blakely asked on 01 Jun 2010, 01:31 AM

I have a RadComboBox holding US State IDs.  From the standpoint of user interaction it works fine.  It is defined as follows:

<telerikInput:RadComboBox HorizontalAlignment="Left" IsEditable="True" x:Name="rmtbStateCode" Width="60" Margin="5" Grid.Column="1" Grid.Row="5" >
       <telerikInput:RadComboBoxItem Content="AZ" />
       <telerikInput:RadComboBoxItem Content="CA" />
</telerikInput:RadComboBox>

However if I try to set the selection in code as follows:

    rmtbStateCode.SelectedValue = myZipCodeClass.ZipData.StateID;

It has no effect. In this case the StateID is "CA" but CA does not show selected.

How can I set it in code?
Thanks,
Gary

 

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 03 Jun 2010, 08:13 AM
Hello Gary Blakely,

Thank you for contacting us.

To make it work you will have to set also the SelectedValuePath property of the ComboBox for example like so:

rmtbStateCode.SelectedValuePath = "Content";

Hope this helps.

If you need further assistance please let us know.

Kind regards,
Konstantina
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.
Tags
ComboBox
Asked by
Gary Blakely
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or