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

RadComboBox - Urgent

3 Answers 14 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gobinath
Top achievements
Rank 1
Gobinath asked on 20 Jun 2014, 08:18 AM
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>

3 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 20 Jun 2014, 09:00 AM
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.
 
0
Gobinath
Top achievements
Rank 1
answered on 20 Jun 2014, 09:31 AM
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.
0
Lance | Manager Technical Support
Telerik team
answered on 20 Jun 2014, 11:13 AM
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.
 
Tags
ComboBox
Asked by
Gobinath
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Gobinath
Top achievements
Rank 1
Share this question
or