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

[Solved] RadGridView not shown in Code behind

4 Answers 161 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manfred
Top achievements
Rank 2
Manfred asked on 07 Feb 2011, 02:38 PM
Hi there,

I have a RadGridView with three columns.
then I created a RowDetailsTemplate and added a DataTemplate with a RadTabControl and two TabItems where both contains a RadGridView

Now my problem: I named the RadGridViews with x:Name="Grid_DetailsParts" and x:Name="Grid_DetailsTimes"
Now I try to access them via C# in my Code behind.
But there are no items with that names.
Here my code:
<telerik:RadGridView x:Name="Grid_OrderHeads"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  ItemsSource="{Binding Path=OrderHeads}"
                  ShowGroupPanel="true"
                  SelectionMode="Single"
                  IsReadOnly="True"
                  CanUserSortColumns="True"
                  CanUserReorderColumns="False"
                  SelectedItem="{Binding Path=SelectedOrderHead, Mode=TwoWay}"
                  Grid.RowSpan="3">
        <telerik:RadGridView.Columns>
          <telerik:GridViewDataColumn  Header="{Binding Source={StaticResource LocalizationHandler}, Path=Provider.OrderNumber}"
                                 DataMemberBinding="{Binding Path=AufNr}" />
          <telerik:GridViewDataColumn  Header="{Binding Source={StaticResource LocalizationHandler}, Path=Provider.ReferenceDate}"
                                 DataMemberBinding="{Binding Path=Addat}" />
          <telerik:GridViewDataColumn  Header="{Binding Source={StaticResource LocalizationHandler}, Path=Provider.OrderType}"
                                 DataMemberBinding="{Binding Path=Auart}" />
        </telerik:RadGridView.Columns>
        <telerik:RadGridView.RowDetailsTemplate>
          <DataTemplate>
            <telerik:RadTabControl BackgroundVisibility="Collapsed" x:Name="radTabControl1" Margin="8" VerticalAlignment="Center" Background="Transparent">
               
              <telerik:RadTabItem Header="Betreiber" Margin="10,0,0,0" Height="24">
                <telerik:RadGridView x:Name="Grid_DetailsParts"
                                     ShowGroupPanel="False"
                                    Grid.Column="2"
                                    ItemsSource="{Binding Path=ServiceOrderDetails.OrderParts}"
                                    AutoGenerateColumns="True">
 
                </telerik:RadGridView>
 
              </telerik:RadTabItem >
              <telerik:RadTabItem Header="Material" Margin="10,0,0,0" Height="24">
                <telerik:RadGridView x:Name="Grid_DetailsTimes"
                    Grid.Column="1"
                    ItemsSource="{Binding Path=ServiceOrderDetails.OrderTimes}"
                    AutoGenerateColumns="True">
 
                </telerik:RadGridView>
              </telerik:RadTabItem>
               
               
            </telerik:RadTabControl>
          </DataTemplate>
        </telerik:RadGridView.RowDetailsTemplate>
      </telerik:RadGridView>

Any idea??

Best Regards




4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 Feb 2011, 02:48 PM
Hello,

 This component is not in your page/user control name scope - you cannot access it like the root grid. 

All the best,
Vlad
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
Manfred
Top achievements
Rank 2
answered on 07 Feb 2011, 02:52 PM
Hi Vlad,

thx.

How can I access this control?

Best Regards
0
Vlad
Telerik team
answered on 07 Feb 2011, 03:03 PM
Hi,

You can use for example Loaded event of the control - sender is the control itself. 

All the best,
Vlad
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
Manfred
Top achievements
Rank 2
answered on 07 Feb 2011, 03:08 PM
Hi,
in this special case I have to use the event of the other GridView, so I can't use sender.

Any other hint?

Best Regards
Tags
GridView
Asked by
Manfred
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Manfred
Top achievements
Rank 2
Share this question
or