This question is locked. New answers and comments are not allowed.
Hi everyone,
im trying to create a 2-level hierarchy Gridview in my application and for some reason, Im struggling to create the child table structure (and inserting data) into my parent grid. Im obtaining my parent grid with expendable rows successfully . I try to replicate what the Hierarchy sample from this site shows but im always getting datacontrol.ParentRow = nothing in my DataLoading event. Here is parts of my code:
As you can see, im using VB and all examples ive found are in CS so maybe it's just a wrong convertion.
My second question is can someone please show me how to insert data into this child grid? Can it be done in the RowLoaded event?
Best regards
im trying to create a 2-level hierarchy Gridview in my application and for some reason, Im struggling to create the child table structure (and inserting data) into my parent grid. Im obtaining my parent grid with expendable rows successfully . I try to replicate what the Hierarchy sample from this site shows but im always getting datacontrol.ParentRow = nothing in my DataLoading event. Here is parts of my code:
| xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" |
| <telerikGridView:RadGridView x:Name="grdData" d:LayoutOverrides="GridBox"> |
| <telerikGridView:RadGridView.ChildTableDefinitions> |
| <telerikGridView:GridViewTableDefinition> |
| <telerikGridView:GridViewTableDefinition.Relation> |
| <telerikData:PropertyRelation ParentPropertyName="Grid_Details"/> |
| </telerikGridView:GridViewTableDefinition.Relation> |
| </telerikGridView:GridViewTableDefinition> |
| </telerikGridView:RadGridView.ChildTableDefinitions> |
| </telerikGridView:RadGridView> |
| Private mData As ObservableCollection(Of GridUDData) Private Sub Grid_DataLoading(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs) Handles grdData.DataLoading |
| Dim dataControl As GridViewDataControl = TryCast(sender, GridViewDataControl) |
| If Not (dataControl.ParentRow Is Nothing) Then 'IT NEVER ENTERS IN HERE! |
| dataControl.CanUserFreezeColumns = False |
| dataControl.ShowGroupPanel = False |
| dataControl.AutoGenerateColumns = False |
| Dim column As GridViewDataColumn = New GridViewDataColumn() |
| column.Header = "Column1" |
| dataControl.Columns.Add(column) |
| dataControl.ItemsSource = mData |
| End If |
| End Sub |
As you can see, im using VB and all examples ive found are in CS so maybe it's just a wrong convertion.
My second question is can someone please show me how to insert data into this child grid? Can it be done in the RowLoaded event?
Best regards