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

Event for column header click?

6 Answers 1245 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 27 Apr 2018, 08:36 PM
Is there an event generated when a column header is clicked, especially when sorting is disabled? I'd like to be able to trigger a customer behavior for a column header click.

6 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 May 2018, 06:11 AM
Hello, Craig,     

In order to detect when a header cell is clicked you can handle the CellClick event and check the row/column passed in the GridViewCellEventArgs:
public RadForm1()
{
    InitializeComponent();
    this.radGridView1.CellClick += radGridView1_CellClick;
}
 
private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
    if (e.Row == this.radGridView1.MasterView.TableHeaderRow && e.ColumnIndex > -1)
    {
        Console.WriteLine("Header cell is clicked");
    }
}

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Craig
Top achievements
Rank 1
answered on 03 May 2018, 03:24 PM
Thank you!
0
Thomas
Top achievements
Rank 1
answered on 08 Oct 2019, 07:15 PM

I'm attempting to use this same approach to capture a click on a RadGridView column header but the CellClick event is not found. Could it be that I'm using an earlier version of Telerik (2017.3.913.45)?

Thanks.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Oct 2019, 02:09 PM
Hello, Thomas,     

The RadGridView.CellClick event is available in the specified version as well. That is why I have attached my sample project for your reference. Could you please give it a try and see how it works? 

I hope this information helps. If you need any further assistance please don't hesitate to contact me.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Thomas
Top achievements
Rank 1
answered on 09 Oct 2019, 02:21 PM

Thank you for your quick response. I just realized that this the Win Forms forum rather than the WPF forum. I'm attempting to do this using WPF. Sorry about the confusion. I am going to re post this in the WPF forum. 

Thanks.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Oct 2019, 09:43 AM

 

Hello, Thomas,     

Yes, indeed, this forum is related to the Telerik UI for WinForms suite. If you have any questions regarding other products, feel free to post them in the relevant forum and thus the respective community will gladly assist you: https://www.telerik.com/forums

Thank you for your understanding.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Craig
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Craig
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Share this question
or