Reputation:

how to get all the rows as well as the column headers from the datagrid to a list

I am currently working on wingrid. In that.. after the data getting displayed in the wingrid, i want to take all the rows from the grid to new list including the column header.

In windows datagrid we will take the column header like this.

List cols = new List(); // populate foreach (ColumnHeader column in Datagrid.Columns) { cols.Add(column); }

but in wingrid there is no class called columnHeader...

Kindly tell me how to take the columns name as well as the rows from the grid to the new list..

Regards,

Ram N

Upvotes: 1

Views: 473

Answers (1)

Hamish Smith
Hamish Smith

Reputation: 8181

If you're using the default System.Windows.Forms.Datagrid then it would be the MappingName or HeaderText property of the DataGridColumnStyle objects held in the GridColumnStyles property of the active DataGridTableStyle in the Datagrid.TableStyles property.

If by 'wingrid' you mean the Infagistics WinGrid (Infagistics.Win.UltraWingrid) then the Columns (a ColumnsCollection) property of the active UltraGridBand in the Bands collection of the active UltraGridLayout in the Layouts collection of the UltraGrid object seems to be what you're after.

Upvotes: 2

Related Questions