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

RadComboBox from DataSources

2 Answers 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Almond
Top achievements
Rank 1
Almond asked on 16 Feb 2011, 11:20 AM
Good day to all.

I have been looking for a solution for my problem for two days and I have seen some threads that have the same scenario as of what I am trying to implement.

I would just like to ask why is it that my RadComboBox is working and getting the data from the DataSource if its outside a DataForm, however, when i tried to insert the same RadComboBox in the DataForm, nothing is happening. 

Basically I have to Tables, Supplier and Country. Supplier has a fields that country which saves the countryID from the country table and i want to display the corresponding countryName from the country table based on that countryID. 

if i am outside a DataForm the following code display the correct RadComboBox:

<

 

 

telerik:RadComboBox telerik:StyleManager.Theme="Windows7" HorizontalAlignment="Left"

 

 

 

Name="RadComboBoxCountry" VerticalAlignment="Top" Width="245"

 

 

 

 

Margin="3" MaxHeight="35" SelectedIndex="0"

 

 

 

 

ItemsSource="{Binding ElementName=CountryDataSource, Path=Data}"

 

 

 

SelectedValue ="{Binding supp_country, Mode=TwoWay}"

 

 

 

SelectedValuePath="country_idno" SelectionChanged="CountryCombo_Changed"

 

 

 

DisplayMemberPath="country_desc">

 

 

 

 

</telerik:RadComboBox>

 


However, I am not able to display the correct SelectedValue from the record that I searched. Please see italics code.

Then, when I placed the same code inside a DataForm where successfully accessed the result of my searching.  The RadComboBox doesnt even display anything.

I am using VB.Net 2010 with a RadControls for Silverlight Q2 2010 SP2.

Also here is how I access my DataSource:

 

 

 

<!--Table Suppliers DataSource-->

 

 

 

 

<riaControls:DomainDataSource Name="SuppliersDataSource" LoadSize="20" QueryName="GetTbl_supplier">

 

 

 

 

<riaControls:DomainDataSource.DomainContext>

 

 

 

 

<ds:AimsContext></ds:AimsContext>

 

 

 

 

</riaControls:DomainDataSource.DomainContext>

 

 

 

 

<riaControls:DomainDataSource.SortDescriptors>

 

 

 

 

<riaControls:SortDescriptor PropertyPath="supp_idno" Direction="Ascending"/>

 

 

 

 

</riaControls:DomainDataSource.SortDescriptors>

 

 

 

 

<riaControls:DomainDataSource.FilterDescriptors>

 

 

 

 

<riaControls:FilterDescriptor PropertyPath="supp_idno"

 

 

 

Operator="IsEqualTo"

 

 

 

IgnoredValue=""

 

 

 

Value="{Binding ElementName= suppIDNoText, Path= Text}">

 

 

 

 

</riaControls:FilterDescriptor>

 

 

 

 

</riaControls:DomainDataSource.FilterDescriptors>

 

 

 

 

</riaControls:DomainDataSource>

 

 

 

 

<!--Table Country DataSource-->

 

 

 

 

<riaControls:DomainDataSource Name="CountryDataSource" AutoLoad="True" QueryName="GetTbl_country">

 

 

 

 

<riaControls:DomainDataSource.DomainContext>

 

 

 

 

<ds:AimsContext></ds:AimsContext>

 

 

 

 

</riaControls:DomainDataSource.DomainContext>

 

 

 

 

<riaControls:DomainDataSource.SortDescriptors>

 

 

 

 

<riaControls:SortDescriptor PropertyPath="country_idno" Direction="Ascending"/>

 

 

 

 

</riaControls:DomainDataSource.SortDescriptors>

 

 

 

 

</riaControls:DomainDataSource>

 


Here's the code for the DataForm:
......

 

 

 

<dataForm:DataField Label="Country 2: ">

 

 

 

 

<!--<TextBox Text="{Binding supp_country, Mode=TwoWay}" />-->

 

 

 

 

<telerik:RadComboBox Grid.Column="1" Grid.Row="4" HorizontalAlignment="Left"

 

 

 

 

ItemsSource="{Binding ElementName=CountrysDataSource, Path=Data}" Margin="3" Name="Supp_countryRadComboBox"

 

 

 

 

VerticalAlignment="Center" Width="150" SelectedValuePath="country_idno" DisplayMemberPath="country_desc"

 

 

 

SelectedValue ="{Binding supp_country, Mode=TwoWay}">

 

 

 

 

<!--<DataTemplate>

 

 

<StackPanel>

 

<TextBlock Text="{Binding country_desc}"/>

 

</StackPanel>

 

</DataTemplate>-->

 

 

 

</telerik:RadComboBox>

 

 

 

 

</dataForm:DataField>

 


Can any one help me with my problem.  I've been looking for a solution for the whole day already and wasn't able to implement some of those codes that I saw. 

Thanks in advance SL Gurus...

almond

2 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 21 Feb 2011, 09:44 AM
Hello Almond,

 
Please, make sure your bindings are correct. Fortunately, we have an example for RadComboBox in a DataForm. Attached you can find the project.

I hope this helps.

All the best,
George
the Telerik team
0
Almond
Top achievements
Rank 1
answered on 21 Feb 2011, 11:24 AM
Much thanks George,

We'll give you a feedback once I have tested the attached file.

Thanks again

almond
Tags
ComboBox
Asked by
Almond
Top achievements
Rank 1
Answers by
George
Telerik team
Almond
Top achievements
Rank 1
Share this question
or