I have a radGrid with a three level hierarchy. The second level has a command button, which is hidden depending on the value of a column. This works well except when the third level is expanded, and the buttons that should be hidden become visible.
The idea is to hide the Edit and Delete buttons if the status of an order is Cancelled.
The code to hide the buttons is:
When the third level of the hierarchy is expanded, ie to show the order details, there seems to be no ItemDataBound event for the second level, so this code isn't executed and the OrderCancelColumn is always visible.
The behaviour is different depending on the HierarchyLoadMode. It has to be ServerOnDemand - the performance is too bad when it is Client.
Can anyoneplease help? Maybe there's a better way to do what we want?
The idea is to hide the Edit and Delete buttons if the status of an order is Cancelled.
The code to hide the buttons is:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) |
'----------------------------------------------------------------------- |
' In the grid, hide the cancel button if the order is not open |
'----------------------------------------------------------------------- |
If "Orders".Equals(e.Item.OwnerTableView.Name) Then |
If TypeOf e.Item Is GridDataItem AndAlso Not e.Item.IsInEditMode Then |
Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) |
Dim Status As String = dataItem("OrderStatus").Text |
If Status <> "O" Then |
' Just replace the cell contents with a space. We do this because |
' if we make the column invisible, the grid lines disappear too. |
dataItem("OrderCancelColumn").Text = " " |
End If |
End If |
End If |
End Sub |
When the third level of the hierarchy is expanded, ie to show the order details, there seems to be no ItemDataBound event for the second level, so this code isn't executed and the OrderCancelColumn is always visible.
The behaviour is different depending on the HierarchyLoadMode. It has to be ServerOnDemand - the performance is too bad when it is Client.
Can anyoneplease help? Maybe there's a better way to do what we want?