This is a migrated thread and some comments may be shown as answers.

Get Column Header of selected cell

2 Answers 190 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hakki
Top achievements
Rank 1
Hakki asked on 25 Sep 2012, 11:05 AM
Hey guys,

When user clicks a cell in the grid I want to grab the column header of that cell and the value that sits at first column of that row. I have achieved the latter but need help on getting the Column header.

Here is where I got to:

private void RDEgrid_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            //rdeView = my data
            var data = RDEgrid.SelectedItem as RdeView;
            MessageBox.Show(data.PatientColumn);
        }

This nicely returns the patient of the selected cell (even after sorting). Now only other data I need is the column header of that cell. How do I get it?

Any help is appreciated.
Hakki.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 25 Sep 2012, 12:20 PM
Hello Hakki,

You can get the column's header for the clicked cell like so:

var column = RDEgrid.CurrentCell.Column as GridViewDataColumn;
var columnHeader = column.Header;

I hope this helps.
Greetings,
Didie
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Hakki
Top achievements
Rank 1
answered on 25 Sep 2012, 01:45 PM
Thanks :)
Tags
GridView
Asked by
Hakki
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Hakki
Top achievements
Rank 1
Share this question
or