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

GridViewComboBoxColumn doesn't show items until clicked on

6 Answers 291 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 25 Aug 2010, 05:08 AM
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

6 Answers, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 27 Aug 2010, 07:23 AM
just "bumping" this post again.  Any help on this would be great.

Thanks,
Joshua
0
Veselin Vasilev
Telerik team
answered on 27 Aug 2010, 08:38 AM
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
0
Leos
Top achievements
Rank 1
answered on 10 Jan 2011, 04:23 PM
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
0
Pavel Pavlov
Telerik team
answered on 11 Jan 2011, 09:35 AM
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>>
0
Leos
Top achievements
Rank 1
answered on 11 Jan 2011, 09:55 AM
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.
0
Maya
Telerik team
answered on 13 Jan 2011, 03:48 PM
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>>
Tags
ComboBox
Asked by
Joshua
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Leos
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Maya
Telerik team
Share this question
or