RadComboBox - Urgent

4 posts, 0 answers
  1. Gobinath
    Gobinath avatar
    2 posts
    Member since:
    Jun 2014

    Posted 20 Jun 2014 Link to this post

    Hi Team,

    Am using the RadCombobox,  and binding also using Observable collection.but am not able to see the items in controls. PFA.

    <telerik:RadComboBox x:Name="cmbRequest" Margin="5,0" Height="20"
    Width="200"
    HorizontalAlignment="Left" ItemsSource="{Binding Path=DropdownText, Mode=TwoWay}"
    SelectedValue="{Binding Path=DropDownValue, Mode=TwoWay}"
    SelectedItem="{Binding Path=DropdownText, Mode=TwoWay}"
    DisplayMemberPath="DropdownText"
    SelectedValuePath="DropDownValue" >
    </telerik:RadComboBox>
  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    138 posts

    Posted 20 Jun 2014 Link to this post

    Hello Gobinath,

    In your ItemsSource declaration, you have this: ItemsSource="{Binding Path=DropdownText, Mode=TwoWay}". (you are also using the same declaration for your SelectedItem)

    It appears you are trying to bind the ItemsSource to a value in the collection, you want to bind ItemsSource to an IEnumerable.  You state that you have an ObservableCollection, that should be set as your ItemsSource.

    You can find more information on DataBinding to an object here. additionally, you can find more information on selection here (contains a tutorial on how to use SelectedValuePath and DisplayMemberPath).

    If you still cannot get it to work, please reply with the model of the object in the ObservableCollection that you have bound to the ComboBox so that I can investigate further.

    Regards,
    Lance
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. Gobinath
    Gobinath avatar
    2 posts
    Member since:
    Jun 2014

    Posted 20 Jun 2014 in reply to Lance | Tech Support Engineer, Sr. Link to this post

    Hi,

    I changed my code as like below

     <telerik:RadComboBox x:Name="cmbRequest" Margin="5,0" Height="20"
    Width="200"
    HorizontalAlignment="Left"
    SelectedValuePath="DropDownValue"
    DisplayMemberPath="DropDownText">
    </telerik:RadComboBox>

    my observable collections are

    if (e.Result != null && e.Result.Count > 0)
    {
    ObservableCollection<Common> ocRequestType;
    ocCommonDropDown = e.Result;
    var RequestType = new ObservableCollection<Common>(ocCommonDropDown.Where(mc => mc.CategoryField == "RequestDisplay"));
    ocRequestType = RequestType;
    this.cmbRequest.ItemsSource = ocRequestType;
    this.cmbRequest.SelectedIndex = 0;

     }

    still am getting the same error. If i selected the item means it its visible see the previous attached image.

    Thanks.
  5. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    138 posts

    Posted 20 Jun 2014 Link to this post

    Hi Gobinath,

    I have written a sample application using your code, please download and run the attached sample. The only difference is I simulate the datasource for "ocRequestType". You'll see that the Teleirk ComboBox is indeed working as expected.

    I recommend that you put a breakpoint at the beginning of your if statement and make sure the data is populating "var RequestType".  As you can see in my example, it works when passed sample data.

    Thank you for contacting Support and thank you for choosing Telerik.

    Regards,
    Lance
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top