datagrid right click menu

adwaitjoshi

Active member
Joined
Dec 29, 2005
Messages
38
Programming Experience
1-3
I have a datagrid that has a right click menu to remove certain items from the grid. When someone right clicks on the grid and selects this menu item, the CurrentRowSelected for the grid comes back as 0. If I click on any item in the grid then do a right click remove company then it works. Is there anyway to know where the user rightclicked without having to take one extra step?
 
I have the exact same problem. I want to manipulate the cells of the selected row but for some reason the right click event doesn't register with the DG.

I'm not at my PC right now, but try simulating a click on the grid. instead of adding the context menu to the grid through the designer, add it at runtime. Then when the Grid.OnClick event is called case the click to see if it is a right click. If it is then call the Grid.SelectionChanged event (or whatever event triggers a selection) with the arguments from the OnClick event (should be able to create a similar event) to get the the cells selected. Then bring up your context menu and voila! In theory it works, provided you know what makes the grid change its selection and that you have access to it... I hope this works, else I hope someone has a better idea!
 
Back
Top