I have a right-click menu like this:
<telerik:EditorTool Name="Hyperlink Properties"/>
when I right click on a link I get my custom popup window.
I would like to have different context menu for hyperlinks and bookmarks.
is this even possible?
5 Answers, 1 is accepted
*to be more precise,
- if user clicks on hyperlink I would like to show right-menu item "Hyperlink Properties" (this is already working for me)
- if user clicks on Bookmark I would like to show "Bookmark Properties"
* the diff between bookmark and hyperlink is bookmark has "name" attribute, and it is missing href attribute.
You can use the oncontextmenu client event to attach to the context menu event of RadEditor and check for the name attribute of the A tag in a similar way as it is shown in the example for IMG tag provided at Custom Context Menus:
thank you Rumen. you are the best. but how do I show different popup text based on link?
when user right-clicks on hyperlink currently the popup menu reads "Hyperlink Properties"
same happens if the right-click on bookmark.
I want to display a different popup menu for bookmark that reads "Bookmark properties", rather than "Hyperlink Properties"
I probably need to intercept the right-click menu and dynamically change the text shown. is that even possible?
another question. my right-click menu on link looks like this:
- Add Comment
- Hyperlink Properties
- Remove Hyperlink
how can I remove the first option (Add Comment)?
Thank you for the nice words!
There is a code library of how to programmatically changing the context menu depending on the selection:
Changing context menu programmatically client-side. The sample provided there will help you implement your scenario via the provided ability to get access to the context menu and manage its items.
As for removing items from the built-in context menus please check out this article: Context Menus Overview. It shows how to predefine the default context menus.