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

Binding data in RadGridView.HierarchyChildTemplate.

0 Answers 121 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kumar p
Top achievements
Rank 1
kumar p asked on 28 May 2010, 07:43 AM

 hi,

 i am using  RadGridView.HierarchyChildTemplate.

 i am using it  for the  first  time  so i need  help from you  guys.

i have  placed  3  grids. now  during page load i want to bind RadGrid1. then once  i clcik my myButton. from that  row  i  have an UniqueName  which i take and as an paramter   to  db  get  an result as   which i need  to bind  to RadGrid2.   again if i click  button2  of  RadGrid2 then again i take an UniqueName  from that  row  again   send as  an paramter to   DB. and get an result  which i need to  bind  to my third grid
1: how  can i be  doing that  functionlity here. any help how to start  would be  greally an  great .
plz let me  know  how to go ahead here.
i do not want  to specify my datasource in xaml like
 this: ItemsSource="{Binding CustomerValues}"

 hope my Question is clear.
 this is my xaml  code.

<Grid x:Name="LayoutRoot">
        <telerik:RadGridView   
                        x:Name="RadGrid1"    ShowGroupPanel="False"  RowIndicatorVisibility="Collapsed"  BorderThickness="0"
                        CanUserInsertRows="False"   
                        AutoGenerateColumns="False"   
                        CanUserFreezeColumns="False"   
                        CanUserReorderColumns="False"
                        Height="600" Width="Auto" Background="#FFC6C6C6">
        
            <telerik:RadGridView.Columns>
<telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Button x:Name="myButton"   
                          Click="ExpandLevel1_Click">
                                <Image  x:Name="imgLevel1" Source="Images/left_side.png" Stretch="None" />
                            </Button>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueName}"   IsVisible="False"  />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"  IsVisible="False" />
                <telerik:GridViewDataColumn Header="Name"  Width="*" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <my:Label Content="{Binding Name}"  />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="FatherName"   Width="100"  >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <my:Label  Content="{Binding FatherName}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="MarksScore" Width="100" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel  Loaded ="SPlevel1MarksScore_Loaded" Orientation="Horizontal" Background="Transparent">
                                <TextBlock Text="{Binding Target}" TextWrapping="NoWrap"   HorizontalAlignment ="Left" Margin="10,0,10,0" Width="25" Foreground="Blue"  ></TextBlock>
                                <Image x:Name ="imgMarksScore" Source ="{Binding TargetColor}" Stretch ="None"  />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="MarksScore"   Width="100" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Loaded ="SPlevel1TrendScore_Loaded" Orientation="Horizontal" Background="Transparent" >
                                <TextBlock Text="{Binding TrendScore}" TextWrapping="NoWrap" HorizontalAlignment ="Left" Margin="10,0,10,0"  Width="25" Foreground="Blue" ></TextBlock>
                                <Image  x:Name="imgTrendScore"  Stretch="None"
                  Source ="{Binding TrendArrow}"  />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate >
                    <StackPanel DataContext="{x:Null}">
                        <telerik:RadGridView  x:Name="RadGrid2"  ShowGroupPanel="False"  RowIndicatorVisibility="Collapsed"  BorderThickness="0"
                                                    CanUserInsertRows="False"   
                                                    AutoGenerateColumns="False"   
                                                    CanUserFreezeColumns="False"   
                                                    CanUserReorderColumns="False"
                                                     Width="Auto" Background="#FFC6C6C6"
                                                    Loaded="ChildRadGridView_Loaded"
                                                    ShowColumnHeaders="False"   
                                                     Style="{StaticResource childGridviewStyle}" >
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn>
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel   Orientation="Horizontal" >
                                                <my:Label Content=" " Background="#3F9ADFF3" Width="24"  BorderThickness="0"/>
                                                <Button x:Name="myButton" Width="24" HorizontalAlignment="Right"   Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"
                            Click="ExpandLevel2_Click" >
                                                    <!--<Image  x:Name="imgLevel2" Source="Images/left_side.png" Stretch="None"
                Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"  />-->
                                                </Button>
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueName}"  IsVisible="False" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"  IsVisible="False" />
                                <telerik:GridViewDataColumn Header="Name"  Width="*" >
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <my:Label  Content="{Binding Name}" />
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="FatherName" Width="100"  >
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <my:Label  Content="{Binding FatherName}" />
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="MarksScore" Width="100">
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel  Loaded ="SPlevel2MarksScore_Loaded" Orientation="Horizontal" Background="Transparent">
                                                <TextBlock Text="{Binding Target}" TextWrapping="NoWrap"   HorizontalAlignment ="Left" Margin="10,0,10,0" Width="25" Foreground="Blue"  ></TextBlock>
                                                <Image x:Name ="imgMarksScore" Source ="{Binding TargetColor}" Stretch ="None"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="TrendScore"  Width="100">
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Loaded ="SPlevel2TrendScore_Loaded" Orientation="Horizontal" Background="Transparent" >
                                                <TextBlock Text="{Binding TrendScore}" TextWrapping="NoWrap" HorizontalAlignment ="Left" Margin="10,0,10,0"  Width="25" Foreground="Blue" ></TextBlock>
                                                <Image  x:Name="imgTrendScore"  Stretch="None"
                  Source ="{Binding TrendArrow}"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                            </telerik:RadGridView.Columns>

                            <telerik:RadGridView.HierarchyChildTemplate  >
                                <DataTemplate >
                                    <StackPanel DataContext="{x:Null}">
                                        <telerik:RadGridView     x:Name="RadGrid3"   CanUserInsertRows="False"   
                                                              Margin="95,0,0,0"  ShowGroupPanel="False"  RowIndicatorVisibility="Collapsed"  BorderThickness="0"
                                                                AutoGenerateColumns="False"   
                                                                CanUserFreezeColumns="False"   
                                                                ShowColumnHeaders="False"   
                                                                Style="{StaticResource childGridviewStyle}"
                                                                CanUserReorderColumns="False"
                                                                Loaded="ChildRadGridView_Loaded" >
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn>
                                                    <telerik:GridViewDataColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <StackPanel   Orientation="Horizontal" >
                                                                <my:Label Content=" " Background="#3F9ADFF3" Width="48"  BorderThickness="0"/>
                                                                <Button x:Name="myButton" Width="24" HorizontalAlignment="Right"   Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"
                            Click="ExpandLevel3_Click" >
                                                                    <!--<Image  x:Name="imgLevel3" Source="Images/left_side.png" Stretch="None"
                Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"  />-->
                                                                </Button>
                                                            </StackPanel>
                                                        </DataTemplate>
                                                    </telerik:GridViewDataColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueName}"  IsVisible="False" />
                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"  IsVisible="False" />
                                                <telerik:GridViewDataColumn Header="Name"  Width="*" >
                                                    <telerik:GridViewDataColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <my:Label  Content="{Binding Name}" />
                                                        </DataTemplate>
                                                    </telerik:GridViewDataColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn Header="FatherName" Width="100" >
                                                    <telerik:GridViewDataColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <my:Label  Content="{Binding FatherName}" />
                                                        </DataTemplate>
                                                    </telerik:GridViewDataColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn Header="MarksScore" Width="100"  >
                                                    <telerik:GridViewDataColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <StackPanel  Loaded ="SPlevel3MarksScore_Loaded" Orientation="Horizontal" Background="Transparent">
                                                                <TextBlock Text="{Binding Target}" TextWrapping="NoWrap"   HorizontalAlignment ="Left" Margin="10,0,10,0" Width="25" Foreground="Blue"  ></TextBlock>
                                                                <Image x:Name ="imgMarksScore" Source ="{Binding TargetColor}" Stretch ="None"  />
                                                            </StackPanel>
                                                        </DataTemplate>
                                                    </telerik:GridViewDataColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn Header="TrendScore" Width="100"  >
                                                    <telerik:GridViewDataColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <StackPanel Loaded ="SPlevel3TrendScore_Loaded" Orientation="Horizontal" Background="Transparent" >
                                                                <TextBlock Text="{Binding TrendScore}" TextWrapping="NoWrap" HorizontalAlignment ="Left" Margin="10,0,10,0"  Width="25" Foreground="Blue" ></TextBlock>
                                                                <Image  x:Name="imgTrendScore"  Stretch="None"
                  Source ="{Binding TrendArrow}"  />
                                                            </StackPanel>
                                                        </DataTemplate>
                                                    </telerik:GridViewDataColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>
                                    </StackPanel>
                                </DataTemplate>
                            </telerik:RadGridView.HierarchyChildTemplate>
                        </telerik:RadGridView>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>
    </Grid>

No answers yet. Maybe you can help?

Tags
GridView
Asked by
kumar p
Top achievements
Rank 1
Share this question
or