GridViewComboBoxColumn doesn't show items until clicked on

7 posts, 0 answers
  1. Joshua
    Joshua avatar
    78 posts
    Member since:
    Sep 2008

    Posted 25 Aug 2010 Link to this post

    I'm not sure if this has something to do with the Async calls or what, but here's the situation.

    I have two tables in my database, DB1 and DB2. Here's the schema:

    DB1
    ARecordID
    ARecord
    AIsActive

    DB2
    BRecordID
    ARecordID (foreign key)
    BRecord
    BFeedIdentifier
    BIsActive

    My XAML:

    <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance MyApp:RecordsA, CreateList=True}" Height="0" LoadedData="recordsADomainDataSource_LoadedData" Name="recordsADomainDataSource" QueryName="GetRecordsA" Width="0">
        <riaControls:DomainDataSource.DomainContext>
            <MyApp:MyAppContext />
        </riaControls:DomainDataSource.DomainContext>
    </riaControls:DomainDataSource>
    <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance MyApp:RecordsB, CreateList=True}" Height="0" LoadedData="recordsBDomainDataSource_LoadedData" Name="recordsBDomainDataSource" QueryName="GetRecordsB" Width="0">
        <riaControls:DomainDataSource.DomainContext>
            <MyApp:MyAppContext />
        </riaControls:DomainDataSource.DomainContext>
    </riaControls:DomainDataSource>
    <telerik:RadGridView HorizontalAlignment="Left" Name="rgvRecords" 
                        VerticalAlignment="Top" ShowGroupPanel="False" 
                        RowIndicatorVisibility="Collapsed"
                        CanUserDeleteRows="True" 
                        ShowInsertRow="True" 
                        CanUserReorderColumns="False" 
                        CanUserResizeColumns="False" 
                        AutoGenerateColumns="False" 
                        CanUserFreezeColumns="False"
                        ItemsSource="{Binding ElementName=recordsBDomainDataSource, Path=Data}"
                        IsBusy="{Binding IsBusy, ElementName=recordsBDomainDataSource}"
                        Deleted="rgvRecords_Deleted"
                        Margin="0,50,0,0"
                        RowEditEnded="rgvRecords_RowEditEnded">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn Header="" Width="75" IsFilterable="False" IsReadOnly="True">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate>
                        <telerik:RadButton Margin="5" Command="telerik:RadGridViewCommands.Delete" CommandParameter="{Binding}">Delete</telerik:RadButton>
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
            <telerik:GridViewComboBoxColumn Width="200" Header="A Record" DataMemberBinding="{Binding ARecordID, Mode=TwoWay}" ItemsSource="{Binding ElementName=recordsADomainDataSource, Path=Data}" SelectedValueMemberPath="ARecordID" DisplayMemberPath="ARecord">
            </telerik:GridViewComboBoxColumn>
            <telerik:GridViewDataColumn Header="B Record" DataMemberBinding="{Binding BRecord, Mode=TwoWay}" Width="*" IsFilterable="False" />
            <telerik:GridViewDataColumn Header="B Feed Identifier" DataMemberBinding="{Binding BFeedIdentifier, Mode=TwoWay}" Width="*" IsFilterable="False" />
            <telerik:GridViewDataColumn Header="Active" DataMemberBinding="{Binding BIsActive, Mode=TwoWay}" Width="150">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox Click="CheckBox_Click" IsChecked="{Binding BIsActive, Mode=TwoWay}" IsEnabled="True" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>


    First off, all the data is binding fine.  However, I'm experiencing a little quirk.  When the page first renders, all the data is displayed EXCEPT the bound items for the GridViewComboBoxColumn.  However, once I click on the one of the records in the GridViewComboBoxColumn, the entire column shows all the correctly bound data.

    I've tried multiple things like Column.Refresh after the grid has loaded. I've tried setting the grid's datasource's AutoLoad to false and then upon recordsADomainDataSource load, call recordsBDomainDataSource.Load().  I've tried a few other things, but to no avail.

    How do I get the GridViewComboBoxColumn to show the data automatically on load without having to click on it?

    Thanks,
    Joshua
  2. Joshua
    Joshua avatar
    78 posts
    Member since:
    Sep 2008

    Posted 27 Aug 2010 Link to this post

    just "bumping" this post again.  Any help on this would be great.

    Thanks,
    Joshua
  3. DevCraft banner
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Aug 2010 Link to this post

    Hi Joshua,

    This troubleshooting article should be of help:
    Empty Cells in Combobox column

    Kind regards,
    Veselin Vasilev
    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
  5. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 10 Jan 2011 Link to this post

    I have the same problem with two RadDomainDataSource.

    My RadGridView is connected to first RDDS (VM property View):
    QueryableDomainServiceCollectionView<Measure>
    ... where Measure  contains MeasureTypeId property/column.

    GridViewComboBoxColumns is connected to VM and second RDDS (VM property  ViewMeasureType):
    QueryableDomainServiceCollectionView<MeasureType>
    ... where MeasureType contains Id (key) and Name (description)

    <telerik:RadGridView Grid.Row="2" ItemsSource="{Binding View}" AutoGenerateColumns="False"  >
     <telerik:RadGridView.Columns>
      <telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding MeasureDate,Mode=TwoWay}"  Width="100"/>
      <telerik:GridViewComboBoxColumn Header="Typ" UniqueName="MeasureTypeId" ItemsSource="{Binding ViewMeasureType}" DisplayMemberPath="Name" SelectedValueMemberPath="Id" DataMemberBinding="{Binding MeasureTypeId, Mode=TwoWay}" />
     </telerik:RadGridView.Columns>
    </telerik:RadGridView>

    After loading data no value is displayed (in ComboBox column), in DB is all OK.

    Described solution is very problematic from ViewModel point of view.

    Leos
  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 Jan 2011 Link to this post

    Hi Joshua,


    Please try placing the second RDDS in a static resource. Then for the ItemsSource binding in the combo column please use binding to this static resource . This should do the trick.

    Regards,
    Pavel Pavlov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  7. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 11 Jan 2011 Link to this post

    Sorry, it does not work (I added my VM with RDDS to StaticResource).
    Could you add some example?
    For me is working only setting ItemsSource in CodeBehind (and this is bad from VM point of view).

    Edit:
    I am Leos, Joshua started this thread in past.
  8. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 13 Jan 2011 Link to this post

    Hi Joshua,

    I am sending you a sample project demonstrating the proposed solution. 
    Let me know if you need any further assistance.

    Kind regards,
    Maya
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner