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

Error "Parent grid cannot be null" when expanding child

3 Answers 107 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.
Peter Meinl
Top achievements
Rank 1
Peter Meinl asked on 03 Feb 2010, 05:31 PM
I am trying to display hierarchical data from a WCF Data Service.
This works fine with the WPF grid. With the Silverlight version I have the following problem.

This Grid displays the Parent Data with fine.
When clicking on the + to expand a child grid a ge the error
System.ArgumentNullException: Parent grid cannot be null
Parameter name: parentGridViewDataControlPeer
   at Telerik.Windows.Controls.GridView.Automation.GridViewCellAutomationPeer..ctor(GridViewCell owner, GridViewDataControlAutomationPeer parentGridViewDataControlPeer)
   at Telerik.Windows.Controls.GridView.GridViewCell.OnCreateAutomationPeer()
   at System.Windows.UIElement.GetOrCreateAutomationPeer()
   at System.Windows.UIElement.OnCreateAutomationPeer(IntPtr nativeTarget, IntPtr& returnAP)

 

 

 

Imports RadControlsSilverlightApplication1.ServiceReference1  
Imports System.Data.Services.Client  
Imports Telerik.Windows.Controls  
 
Partial Public Class MainPage  
    Inherits UserControl  
    Dim ctx As New NorthwindEntities(New Uri("http://localhost:11702/WebDataService1.svc/"))  
 
    Public Sub New()  
        InitializeComponent()  
 
        Dim td As New GridViewTableDefinition()  
        td.Relation = New Telerik.Windows.Data.PropertyRelation("Orders")  
        radGridView.ChildTableDefinitions.Add(td)  
    End Sub 
 
    Private Sub ShowButton_Click(ByVal sender As ObjectByVal e As System.Windows.RoutedEventArgs) Handles ShowButton.Click  
        ShowData()  
    End Sub 
 
    Private Sub ShowData()  
        Dim query As DataServiceQuery(Of Customers) = ctx.Customers.Expand("Orders")  
        query.BeginExecute(AddressOf RequestCompleted, query)  
    End Sub 
 
    Private Sub RequestCompleted(ByVal asyncResult As IAsyncResult)  
        Dim query As DataServiceQuery(Of Customers) = TryCast(asyncResult.AsyncState, DataServiceQuery(Of Customers))  
        Dim customers = query.EndExecute(asyncResult).ToList()  
        Me.radGridView.ItemsSource = customers  
    End Sub 
End Class 

<UserControl xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"  xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  x:Class="RadControlsSilverlightApplication1.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">  
     <Grid x:Name="LayoutRoot">  
        <StackPanel> 
         <telerik:RadButton x:Name="ShowButton" Content="Show"</telerik:RadButton> 
         <telerikGridView:RadGridView x:Name="radGridView"/>  
        </StackPanel> 
  </Grid> 
</UserControl> 

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Feb 2010, 06:35 AM
Hello Peter,

Can you post more info about the grid version?

Regards,
Vlad
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Peter Meinl
Top achievements
Rank 1
answered on 04 Feb 2010, 08:45 AM
The version is: RadControls_for_Silverlight4_2009_3_1314_TRIAL

I have zero experience with Silverlight, so this could be a very simple bug in my code.
0
Vlad
Telerik team
answered on 04 Feb 2010, 09:02 AM
Hello Peter,

Can you send us this project (via support ticket)? I will gladly help you to find what is going on!

Greetings,
Vlad
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
GridView
Asked by
Peter Meinl
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Peter Meinl
Top achievements
Rank 1
Share this question
or