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

RadGridView Inside RadTabControl - Data not loading

4 Answers 235 Views
GridView
This is a migrated thread and some comments may be shown as answers.
shadhan
Top achievements
Rank 1
shadhan asked on 07 Jan 2010, 11:55 AM
Hi Team,

I have a Parent Grid In my page,
Its having hierarchical (projects >> tasks >> comments) data.
My Task grid contains 3 Tab items

I can able to load Tasks  GridView (first tab grid).
But second and third tab grid data are not loaded
Always shows empty GridView

cs page

ProjTasks = GetData(); 
if (outlookProjTasks != null) 
            { 
                GridViewTableDefinition detail1 = new GridViewTableDefinition(); 
                detail1.Relation = new PropertyRelation("Tasks"); 
                detail1.Relation.Name = "Tasks"
 
                GridViewTableDefinition detail2 = new GridViewTableDefinition(); 
                detail2.Relation = new PropertyRelation("ActiveTasks"); 
                detail2.Relation.Name = "ActiveTasks"
 
                GridViewTableDefinition detail3 = new GridViewTableDefinition(); 
                detail3.Relation = new PropertyRelation("CompletedTasks"); 
                detail3.Relation.Name = "CompletedTasks"
 
                this.GrdProjectTasks.TableDefinition.ChildTableDefinitions.Add(detail1); 
                this.GrdProjectTasks.TableDefinition.ChildTableDefinitions.Add(detail2); 
                this.GrdProjectTasks.TableDefinition.ChildTableDefinitions.Add(detail3); 
 
                this.GrdProjectTasks.RowDetailsVisibilityMode = Telerik.Windows.Controls.GridView.GridViewRowDetailsVisibilityMode.VisibleWhenSelected; 
                this.GrdProjectTasks.ItemsSource = ProjTasks
            } 

XAML File

<Grid.Resources> 
            <my:FormattingConverter x:Key="formatter" /> 
            <!--<telerik:RadGridView x:Key="DataSource"/>--> 
            <Style TargetType="telerik:ChildDataControlsPresenter"
                <Setter Property="Template"
                    <Setter.Value> 
                        <ControlTemplate TargetType="telerik:ChildDataControlsPresenter"
                            <TabControl> 
                                <TabItem  Header="All Tasks"
                                    <telerik:RadGridView x:Name="radGridView1" RowLoaded="radGridView1_RowLoaded" LoadingRowDetails="radGridView1_LoadingRowDetails" Height="Auto"  
                                    ShowGroupPanel="True" Margin="0,0,0,0" RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False" AutoGenerateColumns="True" FontFamily="Segoe UI" FontSize="11" FontStretch="5"
                                        <telerik:RadGridView.Columns> 
                                            <telerik:GridViewToggleRowDetailsColumn /> 
                                        </telerik:RadGridView.Columns> 
                                    </telerik:RadGridView> 
                                </TabItem> 
                                <TabItem Header="Active Tasks"
                                    <telerik:RadGridView x:Name="grdActiveTasks" Height="200" ShowGroupPanel="True" Margin="0,0,0,0" RowIndicatorVisibility="Collapsed"  
                                            CanUserFreezeColumns="False" AutoGenerateColumns="True" FontFamily="Segoe UI" FontSize="11" FontStretch="5" ItemsSource="{Binding ActiveTasks}"
                                    </telerik:RadGridView> 
                                    <!--ItemsSource="{Binding MasterRecord.Data.ActiveTasks}"--> 
                                </TabItem> 
                                <TabItem Header="Completed Tasks"
                                    <telerik:RadGridView x:Name="grdCompletedTasks" Height="200" ShowGroupPanel="True" Margin="0,0,0,0" RowIndicatorVisibility="Collapsed" 
                                            CanUserFreezeColumns="False" AutoGenerateColumns="True" FontFamily="Segoe UI" FontSize="11" FontStretch="5" ItemsSource="{Binding Tasks}"
                                        <telerik:RadGridView.Columns> 
                                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Subject}" Header="Subject"/> 
                                        </telerik:RadGridView.Columns> 
                                    </telerik:RadGridView> 
                                    <!--ItemsSource="{Binding MasterRecord.Data.CompletedTasks}"--> 
                                </TabItem> 
                            </TabControl> 
 
                        </ControlTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
            <Style x:Key="GridViewAlternateRowStyle" TargetType="telerik:GridViewRow"
                <Setter Property="Background" Value="#303030" /> 
                <Setter Property="Foreground" Value="White" /> 
                <Setter Property="BorderThickness" Value="1" /> 
                <Setter Property="BorderBrush" Value="Black" /> 
            </Style> 
 
            <Style x:Key="GridViewRowStyle" TargetType="telerik:GridViewRow"
                <Setter Property="Background" Value="#606060" /> 
                <Setter Property="Foreground" Value="White" /> 
                <Setter Property="BorderThickness" Value="1" /> 
                <Setter Property="BorderBrush" Value="Black" /> 
            </Style> 
        </Grid.Resources> 
 
 <telerik:RadGridView Margin="1,60,0,0" RowIndicatorVisibility="Collapsed" IsFilteringAllowed="True"  Name="GrdProjectTasks" FontFamily="Segoe UI" FontSize="11" FontStretch="5" 
            UseAlternateRowStyle="True" ShowGroupPanel="True" CanUserFreezeColumns="False" IsReadOnly="True" RowLoaded="GrdProjectTasks_RowLoaded" 
            DataLoadMode="Asynchronous" RowStyle="{StaticResource GridViewRowStyle}" AlternateRowStyle="{StaticResource GridViewAlternateRowStyle}" GroupPanelBackground="#FF202020"  
            CanUserSortColumns="False" BorderThickness="0" Grid.Column="1" Height="740" Width="1024" Grid.ColumnSpan="2"
            <!--my:GridViewFilterRow.IsEnabled="True"--> 
        </telerik:RadGridView> 


Can you please help on this issue

Regards
Shanthi

4 Answers, 1 is accepted

Sort by
0
shadhan
Top achievements
Rank 1
answered on 07 Jan 2010, 12:02 PM
Hi Team,

One more issue :

If i bind task items (first grid data source) to other tab grids,
Its working and data loaded perfectly.

When i assign the original source "ActiveTasks", it was not loaded.

Can you please tell me, whats wrong with the code

Regards
Shanthi
0
shadhan
Top achievements
Rank 1
answered on 08 Jan 2010, 08:59 AM
Hi Team,

I also assigned the datasource of ChildTableDefinitions using RowLoaded event of the parent GridView

 private void GrdProjectTasks_RowLoaded(object sender, RowLoadedEventArgs e) 
        {           
            GridViewRow row = e.Row as GridViewRow; 
            ProjectTasks proj = e.DataElement as ProjectTasks; 
             
            if (row != null && proj != null) 
            {    
                row.IsExpandable = proj.Tasks.Rows.Count > 0; 
                row.GridViewDataControl.ChildTableDefinitions[0].DataSource = proj.Tasks; 
                row.GridViewDataControl.ChildTableDefinitions[1].DataSource = proj.ActiveTasksDetail; 
                row.GridViewDataControl.ChildTableDefinitions[2].DataSource = proj.CompletedTasksDetail; 
                e.Row.DataContext = row.DataContext; 
            } 
        } 

But still the problem continued
Can u please help on this issue
0
Stefan Dobrev
Telerik team
answered on 11 Jan 2010, 08:33 AM
Hi shadhan,

We had some issue with assigning DataSource to table definitions programmatically. We have addressed this issue and the fix will be available in the service pack release, which we are going to push later this week.

As a side note after looking at your scenario it seems more reasonable if you use the RowDetails feature instead of the custom hierarchy template. Have you looked at our first look online example?

Best wishes,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
shadhan
Top achievements
Rank 1
answered on 12 Jan 2010, 05:09 AM
Hi Stefan,

Thanks for your support.
We already included TASK Details in row details of the GridView.
So we decided to split the tasks by its status in a tab view.

We are waiting for your service update.

Regards,
Shanthi
Tags
GridView
Asked by
shadhan
Top achievements
Rank 1
Answers by
shadhan
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Share this question
or