Mouseclicks on a listbox: Javascript or Asp.Net?


Firstly, apologies about posting a similar problem because there have been different answers on what language and approach to take. This time, I'll try to describe the problem clearer.

In short, I have to display a rightclick menu only when the user rightclicks on a list item in a listbox. If the mouse is not at a list item, the menu will not appear when the user right clicks the mouse.

The listbox is an control, not a vb forms one. It is part of a custom control which consists of the listbox, a context menu and a label. The context menu is itself a custom control developed using c#, not one which is created by javascript. However, there is a javascript file which is included in the context menu code which is responsible for displaying the menu at where the user right clicks.

Hence, my custom control consists of 2 controls and another custom contro(a context menu having c# and javascript coding).

Are there any advice on how to let the listbox and javascript work together to display the menu only at the list items?

I used the context menu control (code included) from this website:

Please advice


  • Hi Weng,

    To get JavaScript to reference the items on a document, tags must be given names, or Id. You may then use the getElementByName() method to pass or retrieve the DOM object. The onMouseOver and onMouseOut events are also available, as well as others, to capture any events on an HTML element.

    Beyond that, it is a matter of setting up your menu. I have yet to program a menu, but be carefull of how events are set up. Different browsers will read events in different order.

    good luck


    [green]WHAT you;see_is_what=you.get;[/green]
    -Russ aka DangeRuss

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion