views:

37

answers:

1

Hello there,

I'm developing an application in C# using visual web developer. I'm displaying some text for reading and I want the user to be able to select a word or fragment, and then right click it to display a customized menu (One that has for example define, search, show grammar...). I I don't know how to do it. I'm fairly new to the .Net

Thanks!

+1  A: 

You have to do that entirely on the client-side, in JavaScript.

Note that it's considered a bad idea to take over right-click, which the user has the right to expect will work the same no matter which application they are using.

John Saunders
True. However I disagree in textareas. It's quite common use, even in the browser, to select some text and rightclick to do something with it (or selecting a link and rightclick to 'unlink' it).
Jan Jongboom
@Jan: I'm not sure I agree with "quite common". If you added something to my menu, that would be fine. But taking over the menu is another story.
John Saunders
Google Maps takes over right-click (on compatible browsers) and it is useful. Overall it's probably a good thing that Opera does not allow anything to change the context-menu, but it would be nice to have the option of allowing sites to add to it, especially for something like Google Maps.
John Ferguson
Sounds good. Though I'm not sure how to use that. Besides, would I be able to manipulate my data easily if I have to use Javascript? I need for example to query a database for definitions for a selected word. I guess a menu in c# is better. no?
Wael
@Wael: the only way to get a right-click menu is client side, in JavaScript. There is no such thing on the server side.
John Saunders