selecting value from code?

2 posts, 0 answers
  1. Gary Blakely
    Gary Blakely avatar
    63 posts
    Member since:
    Jan 2010

    Posted 31 May 2010 Link to this post

    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" />

    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?


  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 03 Jun 2010 Link to this post

    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,
    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.
Back to Top