I need a little help here on identifying the correct level of hierarchy when running this code. I modified your code to hide the + sign for items that don't have sub-items. It's a little quicker than the one you guys document because it doesn't require you to set the auto-expand to true.
The query for my master table brings back the max id value of the sub-items. If it brings back an empty value, I know there are no sub-items and the code hides the +.
So all of this is working great. I'm trying to use the same theory on another project that has a 3 level hierarchy. I don't need to worry about the master table view since I want that to always expand. But I only want the 2nd detail level to expand if I bring back a value in my query.
My question is how to setup the loop in the above code to look at the detail table items. As you can see, it looks at RadGrid1.MasterTableView.Items. Is there another property I can use to look at Detail TableView Items?
Any suggestions you may have are greatly appreciated. Thanks.
| Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs) |
| If Not Page.IsPostBack Then |
| For Each item As GridDataItem in RadGrid1.MasterTableView.Items |
| Dim task_id As String = (TryCast(item.FindControl("lbl_task_id"), Label)).Text |
| If task_id = "" Then |
| Dim cell As TableCell = item.Item("ExpandColumn") |
| Dim expandCollapseButton As ImageButton = CType(cell.Controls(0), ImageButton) |
| expandCollapseButton.Visible = False |
| End If |
| Next |
| End If |
| End Sub |
The query for my master table brings back the max id value of the sub-items. If it brings back an empty value, I know there are no sub-items and the code hides the +.
So all of this is working great. I'm trying to use the same theory on another project that has a 3 level hierarchy. I don't need to worry about the master table view since I want that to always expand. But I only want the 2nd detail level to expand if I bring back a value in my query.
My question is how to setup the loop in the above code to look at the detail table items. As you can see, it looks at RadGrid1.MasterTableView.Items. Is there another property I can use to look at Detail TableView Items?
Any suggestions you may have are greatly appreciated. Thanks.