how to get the visible datagrid columns and column count?

  • Thread starter Thread starter Wiredless
  • Start date Start date
W

Wiredless

Hi,

I need to know which columns in a datagrid are visible and the count of
columns in the datagrid but i dont see a column.count property?

is there a way to do this?
 
Try this snippet,

dataGrid1.DataSource = dt.DefaultView;
..
..
..
DataView dv = (DefaultView)dataGrid1.DataSource;
for(int i=0;i<dv.Columns.Count;i++)
{
//
}

Hope this helps,
Cheers,
Arun.
www.innasite.com
 
The number of visible column in the viewpoint is available through the
DataGrid.VisibleColumnCount property. Also consider to get the list of
visible column by using DataGrid.TableStyles[index].Count.
 
Back
Top