Hi,
I have an issue with hiding columns in Band(1).
In Band(0), hiding a column can be done by:WebHierarchicalDataGrid1.GridView.Columns(0).Hidden = True
So I tried for Band(1):WebHierarchicalDataGrid1.GridView.Band.Bands(1).Columns(0).Hidden = True
But that doesn't work.
Thanks,Andreas
Hi Andreas,
WebHierarchicalDataGrid1.GridView.Band.Bands(1) should be equivalent to
WebHierarchicalDataGrid1.Bands(1) since the Band of the GridView is the Hiearchical grid itself. But anyway. What event are you trying to call this code? By attempting to set the column hidden on the band, you want the column hidden on all children? Let me know and I'll take a look.
regards,David Young
Hi David,
the first thing I do is to hide the default group by-column I defined for the grid in the GroupedRowInitialized event as the data of this column is displayed in the group row and therefore unnecessarily uses up space in the details row. There I use:WebHierarchicalDataGridDetails.GridView.Columns(0).Hidden = TruebecauseWebHierarchicalDataGridDetails.Bands(0).Columns(0).Hidden = Truedoes not work. That's why I tried to go the way over the GridView element also for band 1.
Yes, I want to hide the complete column in all children.
And regarding the event I use to hide the columns in band 1, I tried all that looked promising, but without luck. It is not needed at a special moment in the lifecycle of the page or the control, I just want to hide some columns if some criteria of the logged in user do not match when the page loads.
Regards,Andreas
My InitialDataBindDepth is set to 0 so I'm not binding the children when the parent is loaded. When I try and access the columns in the RowIslandDataBound event, my columns collection is empty. I'm autogenerating columns and want to hide two of them. Any suggestions?
Ok, it works. Thanks!
If your question is how to hide and unhide a grouped column then you can use the GroupedColumnsChanging event similar to the following code snippet:
protected void WebHierarchicalDataGrid1_GroupedColumnsChanging(object sender, GroupedColumnsChangingEventArgs e)
{
if (e.Action == GroupByChangeAction.Group)
foreach (GroupedColumn col in e.EffectedColumns)
e.Band.Columns[col.ColumnKey].Hidden = true;
if (e.Action == GroupByChangeAction.Ungroup)
e.Band.Columns[col.ColumnKey].Hidden = false;
}
Magued
Sorry, it indeed exists in this event and it hides columns.:-)
I only have to find out how I can limit the effect on the lowest band level, depending on how group by is used by the user.
have you checked it in Visual Studio?
My Visual Studio 2008 insists that e.RowIsland is no member of "System.EventArgs" (I'm using VB.NET).