I have a WHDG in which the child band is created at runtime on-demand when the twistie (row expander icon) is clicked by the user. E.g. for a Manager, the subordinate user list is shown when the twistie is clicked. In my case, not all rows are expected to have child band data e.g. when the user is at the lowest level of the reporting hierarchy.My issue is that all rows currently display the twistie regardless of if there is a child-band database available. I believe this is due to the fact that child-band data is generated on demand when the twistie is clicked.Now I can obtain the information if there is child-band data available for a given row when I retrieve the parent dataset as well. Is there anyway to feed this information to the WHDG when the parent row is bound so the twistie is shown for the rows only when there is a child-band data available?
Try setting the IsEmptyParent in the Page PreRender. I had tried that before and know it works. Let me know if you still see any issues.
I tried the following code just to get a start and it didn't create the "Show/Hide Row Expander Twistie." Any suggestions?
Protected Sub WrittenPremiumHierarchicalDataGrid_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles HierarchicalDataGrid.InitializeRow
' don't show the arrow for the last level
If DirectCast(e.Row, ContainerGridRecord).Level < 2 Then
DirectCast(e.Row, ContainerGridRecord).IsEmptyParent = True
End If
End Sub
Thanks. This is exactly what I was looking for.
Hello,
You can use the IsEmptyParent property in order to show or hide the Expand icon:
http://help.infragistics.com/NetAdvantage/ASPNET/2010.3?page=Infragistics4.Web.v10.3~Infragistics.Web.UI.GridControls.ContainerGridRecord~IsEmptyParent.html
I recommend you handling the InitializeRow event for the purpose:
http://help.infragistics.com/NetAdvantage/ASPNET/2010.3?page=Infragistics4.Web.v10.3~Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid~InitializeRow_EV.html
There you can obtain the information if there is child-band data available for a given row and set the property corresponding to this :
protected void WebHierarchicalDataGrid1_InitializeRow(object sender, RowEventArgs e)
{
ContainerGridRecord gridRecord = (ContainerGridRecord)e.Row;
//Set the row as a populatable parent for the first and second level
if (THERE IS CHILD BAND DATA)
gridRecord.IsEmptyParent = true;
}
else
gridRecord.IsEmptyParent = false;