How to Change the Column Header Text in Windows Forms GridDataBoundGrid(Classic)
9 Dec 2019 / 1 minute to read
GridDataBoundGrid by default uses the property name of the content of the columns as the header text. For DataTable, this is the DataColumn.ColumnName property.
To specify a header other than this default one, set GridBoundColumn.HeaderText property for the column. If you have explicitly added GridBoundColumns to GridDataBoundGrid.GridBoundColumns collection, then you must use GridBoundColumns in that collection. If you did not add GridBoundColumns, then you can use GridBoundColumns that are auto generated when you set the datasource to the grid, GridDataBoundGrid.Binder.InternalColumns.
//Changes the Header Text of 'Attribute' Column.
this.gridDataBoundGrid1.Binder.InternalColumns["Attribute"].HeaderText = "NewHeaderText";
'Changes the Header Text of 'Attribute' Column.
Me.GridDataBoundGrid1.Binder.InternalColumns("Attribute").HeaderText = "NewHeaderText"
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page