Mouseclicks on a listbox: Javascript or Asp.Net? - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Mouseclicks on a listbox: Javascript or Asp.Net?

WengWeng Posts: 52Member
Hello,

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 asp.net control, not a vb forms one. It is part of a custom control which consists of the asp.net 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 asp.net controls and another custom contro(a context menu having c# and javascript coding).

Are there any advice on how to let the asp.net 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:
http://msdn.microsoft.com/msdnmag/i...ge/default.aspx

Please advice

Comments

  • CyGuyCyGuy Posts: 312Member
    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

    Russ



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

Sign In or Register to comment.