Get Column Header of selected cell

3 posts, 1 answers
  1. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2012 Link to this post

    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. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Sep 2012 Link to this post

    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.

  3. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2012 Link to this post

    Thanks :)
Back to Top