0

hi! how can i get the column name of the current cell in the radgridview?
RadGridView1 is the name of my datagrid.
these doesn't work:

RadGridView1.CurrentCell.Column.ToString();
RadGridView1.CurrentCellInfo.Column.ToString();
RadGridView1.CurrentColumn.ToString();

help me please...

4
Contributors
4
Replies
9
Views
7 Years
Discussion Span
Last Post by abelLazm
0

Hi, to add to ddanbe`s post.
You can do it this way too:

foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                foreach (DataGridViewCell cell in row.Cells)
                { 
                 //CELL here does not have a property of HeaderText.
                    //so you can do it like ddanbe showed or:
                    string header = dataGridView1.Columns[cell.ColumnIndex].HeaderText;
                }
            }
0

thanks for your suggestion. but it doesn't work. here's the error:

Telerik.Windows.Controls.GridViewColumn does not contain a definition for HeaderText

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.