Declined
Last Updated: 06 Jun 2018 07:31 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 18 Sep 2017 08:45
Category: GridView
Type: Bug Report
1
FIX. RadGridView - ArgumentException when adding an item in the ContextMenuOpening
Use attached to reproduce.

This is not an issue. Performing Begin/End update disposes of all elements along with the globally declared item. You need to check if the item is disposed of:
void ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (menuItem.IsDisposed)
    {
        menuItem = new RadMenuItem();
        menuItem.Text = "Custom menu item";
        menuItem.Click += menuItem_Click;
    }
    e.ContextMenu.Items.Add(menuItem);
}
1 comment
ADMIN
Dimitar
Posted on: 06 Jun 2018 07:31
This is not an issue. Performing Begin/End update disposes all elements along with the globally declared item. You need to check if the item is disposed of:

void ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
if (menuItem.IsDisposed)
{
menuItem = new RadMenuItem();
menuItem.Text = "Custom menu item";
menuItem.Click += menuItem_Click;
}
e.ContextMenu.Items.Add(menuItem);
}