I would like to pop up the context menu when an image (Downward arrow in the screenshot) is left clicked in radgrid. Moreover, options in the context menu and its navigate url will vary for each row in grid. How would you implement such scenario? In all your examples, you just have one context menu for all the rows in grid. How do you dynamically populate the context menu based on some radgrid row data?
4 Answers, 1 is accepted
To show a context menu, when a user clicks on image, you could try using the following code snippet:
The ShowContextMenu function could be called when the image is clicked. You could try attaching the handler to the image.onclick event on the RadGrid.ItemDataBound event handler:
I am sending you a simple example which demonstrates the functionality concerning the showing context menu when the user clicks image.
Additionally to show only the relevant menu items you could try showing/hiding some of the menu items on the client, when the menu is shown or you could try adding the different menus for the different items.
Also you could add the menu's items dynamically on the client. Please check out the following demo which demonstrates this:
I hope this helps.
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thought I'd post my question on this thread, because this information got me as far as I am now, working with the ContextMenu :)
So, I used the code Radoslav wrote above, and I've got one menu showing for each row of the Grid.
I was also able to add and remove menu items in the code behind.
My question is: can I have different menus, one for each row of the Grid?
I'm trying to do something like:
I don't know if this is possible though... Thought I'd ask first if it is, before submitting a support ticket or looking into a different approach.
Thanks in advance!
Hmm... Whether or not this functionality could be achieved with the context menu, I think I'll be using the RadMenu, like this:
Simple to use and looks really nice.
I am glad that you achieved the desired functionality by using the RadMenu. In case you experience any further problems, do not hesitate to contact us again.
the Telerik team