We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Column Header

Thread ID:





103312 Apr 20,2012 01:08 PM UTC Apr 23,2012 07:16 AM UTC WPF 1
Tags: GridControl
Fred Marechal
Asked On April 20, 2012 01:08 PM UTC


Could you let me know how to obtain the list of column names (headers) fron a grid (not the underlying data).

I tried something like this:

for (int i = 0; i < mainGrid.Model.ColumnCount; i++)
string name = GridRangeInfo.GetAlphaLabel(i);

However, I obtain the name = "A" , name = "B", name = "C", etc... instead of the real column names, e.g. name = "ID", name = "Name", name = "Address"

Could you advise please?

Thank you


Rajasekar [Syncfusion]
Replied On April 23, 2012 07:16 AM UTC

HI Fred,

Thanks for your update. You can achieve this requirement by using the below code snippet,

///Way #1
List _columnHeaders = new List();
foreach (GridDataVisibleColumn vc in this.dataGrid.VisibleColumns)
if (vc.HeaderText == null || vc.HeaderText == "")

///Way #2
List _columnHeaders1 = new List();
int tempIndex = 0;
if (this.dataGrid.ShowRowHeader)
tempIndex = tempIndex + 1;

if (this.dataGrid.GroupedColumns.Count > 0)
tempIndex = tempIndex + this.dataGrid.GroupedColumns.Count;

for (int col = tempIndex; col < this.dataGrid.Model.ColumnCount; col++)
_columnHeaders1.Add(this.dataGrid.Model[0, col].CellValue.ToString());

For your reference, please find the sample in the below location,

Sample: SyncfusionGDC.zip

Note: We have found that, the similar queries is posted in the Incident #93556. We have also updated the details in that Incident too. If you have any queries we request you to update in that Incident Itself for better follow up.

Please let us know if you have any queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon