Hi,I have below requirement.I want to display default context menu on the grid(cut/copy/paste etc..) when cell is in edit mode. But when cell is not in edit mode, I want
to display my own contextmenu strip.I tried making contextmenustrip property null on Afterentereditmode event and then reassign my contextmenustrip on afterexiteditmode event
but did not helo. It always shows the contextmenu strip which i assigned in afterexitmode event .I tried in MouseUp event and handle the right click as well to do the same as above (check if cell is in edit mode or not and accordingly show the contextmenustrip)
but when cell is in edit mode then mouseup event does not get fired.Please help..
Thanks
Hello,
I think that now I get your requirements right. And I believe that you should take the road with the two separate custom menus, making the one having the needed options from the default context menu.
Hi Boris,Please go through my requirement again.I need the default context menu of the grid on edit mode(which is provided by the os i.e. Cut/Copy/Paste/Select All etc..) and
want my custom menu when grid is not in edit mode..
I do not want 2 seperate custom menu but one default and one custom..
I hope it clears the requirement.
Hello pravinkumard,
I do not know if you tried the proposed solution, but I am sure that it works. It is a possible approach to achieve what you want. So I attached a sample to this post, showing what I mean. Please take a look and let me know if there is something wrong.
Hi Boris,
Thanks for your quick reply.
As i said in my original post that I have already tried the AfterEnterEditMode and AfterExitEditMode but does not work.Let me clarify once again the problem.I need to display the default context menu which is available on the ultragrid in edit mode(cut/Copy/Paste/Select All etc) but when cell is not in edit menu i want to display
my app specific context menu.The said solution always shows "ENTERED". Please reply
What you could do is to assign a contextmenustrip on initializing of the WinGrid, then catch the AfterEnter and AfterExit edit mode events and do something like the following:
private void ultraGrid1_AfterEnterEditMode(object sender, EventArgs e) { ultraGrid1.ContextMenuStrip.Items.RemoveAt(0); ultraGrid1.ContextMenuStrip.Items.Add("ENTERED"); } private void ultraGrid1_AfterExitEditMode(object sender, EventArgs e) { ultraGrid1.ContextMenuStrip.Items.RemoveAt(0); ultraGrid1.ContextMenuStrip.Items.Add("EXITED"); }
Please do not hesitate to contact me if you need any additional assistance.