Event for column header click?

7 posts, 1 answers
  1. Craig
    Craig avatar
    2 posts
    Member since:
    Oct 2017

    Posted 27 Apr 2018 Link to this post

    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.
  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3416 posts

    Posted 02 May 2018 Link to this post

    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.
  3. Craig
    Craig avatar
    2 posts
    Member since:
    Oct 2017

    Posted 03 May 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thank you!
  4. Thomas
    Thomas avatar
    3 posts
    Member since:
    Jan 2019

    Posted 08 Oct in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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.

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3416 posts

    Posted 09 Oct Link to this post

    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.
  6. Thomas
    Thomas avatar
    3 posts
    Member since:
    Jan 2019

    Posted 09 Oct in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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.

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3416 posts

    Posted 10 Oct Link to this post

     

    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.
Back to Top