Version Upgrade Issue

1 Answer 4 Views
GridView
Top achievements
Rank 1
Iron
Iron
Iron
asked on 04 Feb 2026, 02:05 PM

private void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { var cellElement = e.ContextMenuProvider as GridCellElement; if (cellElement == null) return;

if (cellElement is GridHeaderCellElement)
{
    RadMenuItem exportExcel = new RadMenuItem($"ExportToExcel");
    exportExcel.Click += (s, args) => { ExportToExcel(); };
    e.ContextMenu.Items.Add(exportExcel);
}

}

After upgrade to UI.for.WinForms.AllControls.Net80 <Version>2025.4.1321

cellElement is null in the above line

then return

i can not see "RadMenuItem($"ExportToExcel")"

WHY?

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 04 Feb 2026, 03:13 PM | edited on 04 Feb 2026, 03:15 PM

Hello,

Thank you for providing your code snippet regarding ContextMenuOpening event.

In version 2025.4.1321, we introduced an optimization to improve the display of the context menu. With this change, when a user clicks a column header cell, the ContextMenuProvider is now the GridViewColumn rather than the GridHeaderCellElement (as it was before). This adjustment ensures that the context menu displayed corresponds specifically to the selected column (rather than cell), matching the user's expectations.

Now, you need to adjust your code snippet a little and check for GridViewColumn. Thus, the ExportToExcel option will show every time you click on a column header, and it will continue to work as before:

private void RadGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    var column = e.ContextMenuProvider as GridViewColumn;
    if (column == null) return;

    if (column is GridViewColumn)
    {
        //if you click on a column header, then show ExportToExcel option
        RadMenuItem exportExcel = new RadMenuItem($"ExportToExcel");
        exportExcel.Click += (s, args) => { ExportToExcel(); };
        e.ContextMenu.Items.Add(exportExcel);
    }
}

I hope this information helps. Please let me know if you have any other questions.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Top achievements
Rank 1
Iron
Iron
Iron
commented on 04 Feb 2026, 03:26 PM

it works 

Thans a lot

Tags
GridView
Asked by
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or