We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Context menu for grid cell with focus

I need to provide a custom context menu that may be different for each cell in a grid. If the cell does not have focus this can be triggered off the MouseDown event. If it does have focus you have to do something like this. This strategy works fine for the case where each grid cell has the same context menu. If I want to have custom menu for each cell is there a preferred way to do this? I think I can simply override tb.ContextMenu for each cell. Can I count on each grid having one GridTextBoxControl control or do I need to fetch it every time a cell gets focus?

1 Reply

AD Administrator Syncfusion Team May 20, 2003 08:20 AM

Normally, there is a single GridTextBoxControl shared among all cells that have CellType "TextBox". If you use grid.Model.CellModels.Add, you can add additional textboxes, or change the the one that might already be there. But you would have to explicitly do this. In any case, another option might be to just swap the contextmenu out in CurrentCellStartEditing. The code you referenced went to some trouble to only do it once, but you could also do it as needed based on the grid.CurrentCell.RowIndex and grid.CurrentCell,ColIndex, and the currently assigned menu.

Loader.
Live Chat Icon For mobile
Up arrow icon