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

DataGrid RowDetails not loading

3 Answers 116 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Chris Ward
Top achievements
Rank 1
Chris Ward asked on 04 May 2011, 09:36 PM
Hello,

I am trying to use two DomainDataSource controls to create a master\detail grid utilizing the RowDetails feature of the DataGrid.  I am following the demo shown here: http://demos.telerik.com/silverlight/#DomainDataSource/RowDetails

I am finding that the DataGrid inside the RowDetails does not display the data, just an empty DataGrid.   To test the DomainDataSouce for the details, I created a second independant DataGrid that is also bound to the details DomainDataSource as shown in your demo: http://demos.telerik.com/silverlight/#DomainDataSource/MasterDetail 

When I run the application, the master DataGrid (gvProducts) displays the products.  When I select a product, in the master DataGrid, the second DataGrid shows the corresponding detail information, however the DataGrid in the RowDetails section shows an empty DataGrid.

Is there something that I am missing to get the DataGrid in the RowDetails secotion to bind correctly?  Here is my xaml.

Thanks so much,

Chris

<UserControl x:Class="VMSPatchManager.MainPage"
    xmlns:web="clr-namespace:VMSPatchManager.Web"
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
  
  
  
    <Grid x:Name="LayoutRoot" Background="White">
  
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
  
        <telerik:RadDomainDataSource x:Name="ProductsDataSource" PageSize="15" AutoLoad="True" QueryName="GetTblProducts" LoadedData="ProductsDataSource_LoadedData">
            <telerik:RadDomainDataSource.DomainContext>
                <web:VMSPatchesContext />
            </telerik:RadDomainDataSource.DomainContext>
        </telerik:RadDomainDataSource>
  
        <telerik:RadDomainDataSource x:Name="PatchesDataSource" PageSize="10" AutoLoad="True" QueryName="GetTblPatchesByProductID">
            <telerik:RadDomainDataSource.DomainContext>
                <web:VMSPatchesContext />
            </telerik:RadDomainDataSource.DomainContext>
            <telerik:RadDomainDataSource.QueryParameters>
                <telerik:QueryParameter ParameterName="ProductID" Value="{Binding SelectedItem.ProductID, ElementName=gvProducts}" />
            </telerik:RadDomainDataSource.QueryParameters>
        </telerik:RadDomainDataSource>
  
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <telerik:RadButton x:Name="submitChangesButton" Content="Submit Changes"
                               Command="{Binding SubmitChangesCommand, ElementName=ProductsDataSource}" 
                               CommandTarget="{Binding ElementName=ProductsDataSource}"/>
            <telerik:RadButton x:Name="rejectChangesButton" Content="Reject Changes" 
                               Command="{Binding RejectChangesCommand, ElementName=ProductsDataSource}" 
                               CommandTarget="{Binding ElementName=ProductsDataSource}"/>
        </StackPanel>
  
        <StackPanel  Grid.Row="1">
        <telerik:RadGridView x:Name="gvProducts" 
                             ItemsSource="{Binding DataView, ElementName=ProductsDataSource}"
                             IsBusy="{Binding IsBusy, ElementName=ProductsDataSource}"
                             RowDetailsVisibilityMode="VisibleWhenSelected"
                             ShowGroupPanel="False"
                             CanUserFreezeColumns="False"
                             RowIndicatorVisibility="Visible" 
                             IsFilteringAllowed="False"
                             CanUserSortColumns="False"
                             AutoGenerateColumns="true" 
                             IsReadOnly="True" SelectionChanged="gvProducts_SelectionChanged">
  
              
            <!-- Row details-->
            <telerik:RadGridView.RowDetailsTemplate>
                <DataTemplate>
                    <Border >
                        <telerik:RadGridView Margin="5"
                                             ItemsSource="{Binding DataView, ElementName=PatchesDataSource}"
                                             IsBusy="{Binding IsBusy,ElementName=PatchesDataSource}">
  
                            <telerik:RadGridView.Columns>                                                                
                            </telerik:RadGridView.Columns>                            
                        </telerik:RadGridView>
                    </Border>
                </DataTemplate>
            </telerik:RadGridView.RowDetailsTemplate>
        </telerik:RadGridView>
  
            <!-- seperate grid-->
        <telerik:RadGridView x:Name="gvPatches" 
                             ItemsSource="{Binding DataView, ElementName=PatchesDataSource}"
                             IsBusy="{Binding IsBusy, ElementName=PatchesDataSource}">
        </telerik:RadGridView>
        </StackPanel>
    </Grid>
</UserControl>


3 Answers, 1 is accepted

Sort by
0
vk
Top achievements
Rank 1
answered on 05 May 2011, 07:40 AM
Hi, Chris
Declare RadDomainDataSource controls as resources:

<Grid x:Name="LayoutRoot" Background="White"
    <Grid.RowDefinitions
        <RowDefinition Height="Auto" /> 
        <RowDefinition Height="*" /> 
    </Grid.RowDefinitions
  
  
  <Grid.Resources
    <!--DomainContext-->
    <web:VMSPatchesContext x:Key="DomainContext" /> 
   <!--ProductsDomainDataSource-->
    <telerik:RadDomainDataSource x:Key="ProductsDataSource"
DomainContext="{StaticResource DomainContext}" 
PageSize="15" 
AutoLoad="True" 
QueryName="GetTblProducts" 
LoadedData="ProductsDataSource_LoadedData" /> 
 <!--PatchesDomainDataSource-->
    <telerik:RadDomainDataSource x:Key="PatchesDataSource"
DomainContext="{StaticResource DomainContext}" 
PageSize="10" 
AutoLoad="True" 
QueryName="GetTblPatchesByProductID"
           <telerik:RadDomainDataSource.QueryParameters
            <telerik:QueryParameter ParameterName="ProductID" 
Value="{Binding SelectedItem.ProductID,ElementName=gvProducts}" /> 
             </telerik:RadDomainDataSource.QueryParameters
     </telerik:RadDomainDataSource
    </Grid.Resources>
</Grid>

And change ItemsSource property of your product and patches grids like
ItemsSource="{Binding DataView, Source={StaticResource ProductsDataSource}}"
ItemsSource="{Binding DataView, Source={StaticResource PatchesDataSource}}"


0
Chris Ward
Top achievements
Rank 1
answered on 05 May 2011, 02:29 PM
That worked perfectly.  Thank you so much!

Best regards,

Chris
0
Chaojie
Top achievements
Rank 1
answered on 08 Mar 2012, 04:49 AM
That's works fine. i am a newbie to silverlight&telerik, i am curious about the reason to declare domain data source as Resources? why this works good? any related document?
thx
Tags
DomainDataSource
Asked by
Chris Ward
Top achievements
Rank 1
Answers by
vk
Top achievements
Rank 1
Chris Ward
Top achievements
Rank 1
Chaojie
Top achievements
Rank 1
Share this question
or