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

GridView: Column Header

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 07 Aug 2010, 10:30 AM
Hi Everyone,

I have a problem getting the column header of the selected GridView Cell. Before upgrading to telerik 4 and SL4 the following snippet was working fine. But now every time CurrentCell property returns null.

private void RadGridView1_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if (((Telerik.Windows.Controls.RadGridView)sender).CurrentCell.Column.Header.ToString().ToLower() == "name")
            {
                //Some Code........
            }
        }

Anyone facing this issue?? Need help ASAP.

Thanks

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 11 Aug 2010, 12:53 PM
Hello Gaurav,

Depending on your scenario and requirements you may transfer the logic in the CurrentCellChanged event of the grid. For example:

private void playersGrid_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)
{           
    RadGridView grid = sender as RadGridView;
    if(grid!= null)
    {
     MessageBox.Show(grid.CurrentCell.Column.Header.ToString());
    }                      
}

Furthermore, in case you are aiming at getting the Header the current column, you may use the property of the grid CurrentColumn.
 


Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or