I tried the http://www.telerik.com/help/aspnet-ajax/grid-hide-expand-collapse-images-when-no-records.html way of hiding the expand/collapse image but with no success. I don't use the HierarchyLoadMode = ServerBind way of populating the details table - but I don't have a problem populating the details table.
Here is the code for the detail table bind and my attempt to hide the collapse/expand column for parent rows with no detail items:
It seems like this should be an easy thing to do but I cannot find the answer. Thanks in advance for any help I get with this.
Here is the code for the detail table bind and my attempt to hide the collapse/expand column for parent rows with no detail items:
Private
Sub
RadGridEvents_DetailTableDataBind(
ByVal
source
As
Object
,
ByVal
e
As
GridDetailTableDataBindEventArgs)
Handles
RadGridEvents.DetailTableDataBind
Dim
dataItem
As
GridDataItem =
CType
(e.DetailTableView.ParentItem, GridDataItem)
Select
Case
e.DetailTableView.Name
Case
"EventMerchantList"
Dim
EventID
As
Integer
= dataItem.GetDataKeyValue(
"eventID"
)
Dim
eventML
As
List(Of Merchant)
eventML = Merchant.GetAllMerchantsByEventID(EventID)
If
Not
eventML
Is
Nothing
Then
If
eventML.Count > 0
Then
e.DetailTableView.DataSource = eventML
End
If
End
If
End
Select
End
Sub
Protected
Sub
RadGridEvents_PreRender(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
HideExpandColumnRecursive(RadGridEvents.MasterTableView)
End
Sub
Public
Sub
HideExpandColumnRecursive(
ByVal
tableView
As
GridTableView)
Dim
nestedViewItems
As
GridItem() = tableView.GetItems(GridItemType.NestedView)
For
Each
nestedViewItem
As
GridNestedViewItem
In
nestedViewItems
For
Each
nestedView
As
GridTableView
In
nestedViewItem.NestedTableViews
If
nestedView.Items.Count = 0
Then
Dim
cell
As
TableCell = nestedView.ParentItem(
"ExpandColumn"
)
cell.Controls(0).Visible =
False
nestedViewItem.Visible =
False
End
If
If
nestedView.HasDetailTables
Then
HideExpandColumnRecursive(nestedView)
End
If
Next
Next
End
Sub
It seems like this should be an easy thing to do but I cannot find the answer. Thanks in advance for any help I get with this.