I am trying to look for an example in VB on how to create a Self-referencing hierarchy grid dynamicaly. I have created one where i declare all the columns and parameters. However I want to create it entirly dynamicaly. I am already creating a standard grid in this manner, however I wish to add this option into the user control created.
I included some code, however would like to see an example if possible.
Just a snippet, the issue I have with this is that when I click on the arrow, nothing expands. Not sure where I am going wrong here. Like I said I can get it working when not creating it dynamicaly. Also like to add, I am plugging this into a usercontrol that already creates a normal grid dynamicaly.
Just wondering If I need to do something extra?
I included some code, however would like to see an example if possible.
' the nestedDatasource is a dataset with a relation added If NestedTable Then RadGrid1.EnableLinqExpressions = False RadGrid1.ClientSettings.AllowExpandCollapse = True RadGrid1.MasterTableView.HierarchyDefaultExpanded = False RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerBind RadGrid1.MasterTableView.SelfHierarchySettings.KeyName = NestedTableKey RadGrid1.MasterTableView.SelfHierarchySettings.ParentKeyName = NestedTableParentKey ' RadGrid1.MasterTableView.SelfHierarchySettings.MaximumDepth = 0 Dim expandCollapseColumn As New GridExpandColumn expandCollapseColumn.HeaderStyle.Width = 20 RadGrid1.MasterTableView.Columns.Add(expandCollapseColumn) RadGrid1.MasterTableView.ShowHeader = False RadGrid1.MasterTableView.HierarchyDefaultExpanded = False Datasource = NestedDatasource.Tables(0) End If....'create the columns dynamicaly from the dataset boundColumn = New GridBoundColumn RadGrid1.MasterTableView.Columns.Add(boundColumn) boundColumn.DataField = column.ColumnName boundColumn.HeaderText = column.ColumnName.Replace("_", " ").ToLower() If colDataType = "int32" Then boundColumn.DataFormatString = "<nobr>{0:N0}</nobr>" boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center .......... Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource If NestedTable Then RadGrid1.MasterTableView.VirtualItemCount = NestedDatasource.Tables(0).Rows.Count() RadGrid1.DataSource = NestedDatasource RadGrid1.Visible = True Else If Not Datasource Is Nothing Then RadGrid1.MasterTableView.VirtualItemCount = Datasource.Rows.Count() RadGrid1.DataSource = Datasource RadGrid1.Visible = True Else RadGrid1.Visible = False Exit Sub End If End If End SubJust wondering If I need to do something extra?