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

Column header click event

1 Answer 655 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc-Andre
Top achievements
Rank 1
Marc-Andre asked on 06 Oct 2009, 03:28 PM
Hi, I can't seem to find a way to catch when the user click the column header. I'm trying to update all the checkboxes whithin the grid when the user hit the header.

Any idea?

Thanks

1 Answer, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 08 Oct 2009, 03:10 PM
Hello Marc-Andre,

You can detect when the user clicks a column header by subscribing to the CellClick event. Keep in mind though, that the default behavior of clicking a column header is to sort the grid based on that column. Therefor you should probably make sure to disable sorting on that particular column.

        private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) 
        { 
            if (e.Row is GridViewTableHeaderRowInfo) 
            { 
                if (e.Column.HeaderText == "ToolPartID"
                { 
                    UpdateCheckBoxes(); 
                } 
            } 
        } 
 
        private void UpdateCheckBoxes() 
        { 
            // Update the check boxes 
        } 

I hope this helps.

- Robert
Tags
GridView
Asked by
Marc-Andre
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Share this question
or