RadComboBox from DataSources

3 posts, 0 answers
  1. Almond
    Almond avatar
    43 posts
    Member since:
    Feb 2011

    Posted 16 Feb 2011 Link to this post

    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. George
    Admin
    George avatar
    1332 posts

    Posted 21 Feb 2011 Link to this post

    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
  3. DevCraft banner
  4. Almond
    Almond avatar
    43 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2011 Link to this post

    Much thanks George,

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

    Thanks again

    almond
Back to Top