Hi Andrea,
Well, you will not be able to reference the menu item [0] at design time because it doesn't exist until runtime. If you are trying to differentiate the menu items you can view the Text property of the item.
if (string.Compare(e.ContextMenu.Items[0].Text, "Copy", true) == 0)
Thanks but my problem is I need to remove any of item in contextopening.
If I refer to index, it's ok until I change options for gridview (example, if I allow or not to delete row, the menu struture differ and my code isn't valid.
I can't refer to text because the texte items is localized. So the text isn't the same.
0
Nick
Telerik team
answered on 07 Nov 2008, 02:01 PM
John's suggestion is very good. You can still use the localized strings to check the menu content items.
I could also think of other alternatives like using the e.ContextMenu.Items.Count property or some boolean flags keeping track of the changes of the menu items structure (e.g. Copy/Paste change).