This is a migrated thread and some comments may be shown as answers.

Two grids and column context menu

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam Nelson
Top achievements
Rank 2
Adam Nelson asked on 01 May 2008, 08:54 PM
Hi,

I have a page that has two RadGrids on the form and a RadContextMenu.

I added a tagname target of thead, but really only want it to show for one of the grids. So i have separate OnColumnContextMenu client functions for the grids, one that tracks which column the menu was opened from, the other that (i'm hoping) will hide the context menu.

I would set the target to the control id of the grid I want to enable the context menu on, but I dont want it to be available when clicking on rows in the grid.

function

HideContextMenu(sender, eventArgs)
{
    
return false;
}


this does not seem to work and eventArgs.set_cancel(true) is not an option either.

Any ideas/solutions would be appreciated.

Thanks

2 Answers, 1 is accepted

Sort by
0
Nikita Gourme
Top achievements
Rank 1
answered on 05 May 2008, 08:18 AM
Adam, my suggestion is instead of setting tagname target for the context menu, catch the OnColumnContextMenu event of the grid and show/hide the menu with the show()/hide() methods from the client-side API. Thus you will be able to control the context menu appearance in a more robust and flexible way when having multiple grids on the page.

See the solution from this demo for more info:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Controls/Examples/Integration/GridAndMenu/DefaultCS.aspx?product=grid

Nikita
0
Adam Nelson
Top achievements
Rank 2
answered on 12 May 2008, 07:12 PM
I was able to solve my issue by using the OnClientShowing property of the context menu, it now checks a global javascript variable and calls eventArgs.set_cancel(true). There is probably a cleaner way to get this done, but in my unique situation it was the only way that would work for me.
Tags
Grid
Asked by
Adam Nelson
Top achievements
Rank 2
Answers by
Nikita Gourme
Top achievements
Rank 1
Adam Nelson
Top achievements
Rank 2
Share this question
or