I have a simple WebGrid where I'm trying to hide some columns. I've set the column.Hidden attribute to true however when the grid is displayed the column headers and column values are not displayed but there appears to be an empty column displayed in the grid.
I've attached a screen shot with the areas of concern circled. Is this expected behavior? Is there any way to prevent this?
Thanks
Hello,
Thanks for writing. Unfortunately it appears that the screenshot did not make it (at least I am not seeing one). Am I missing something?
In any case, I tried binding a simple WebGrid to a Northwind datatable and set one of the columns there Hidden = True and could not observe what you see. Please, see the screenshot attached for what I get for this setup (notice that I have three columns and I set the third one Hidden = True)
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AccessDataSource1"> <bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="CustomerID" IsBound="True" Key="CustomerID"> <Header Caption="CustomerID"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="CompanyName" IsBound="True" Key="CompanyName"> <Header Caption="CompanyName"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="ContactName" IsBound="True" Key="ContactName" Hidden="true"> <Header Caption="ContactName"> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> </Columns> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> </igtbl:UltraGridBand> </bands>
No, you didn't miss anything. I could not figure out how to add an attachment so I've now uploaded the image of the grid and can add this link.
This is a grid where the data is bound to a class at run time and where the 2nd band rows are added at run time as well if that makes any difference.