Mouseclicks over a listbox: JavaScript or Asp.Net?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Mouseclicks over a listbox: JavaScript or Asp.Net?

  1. #1
    Join Date
    Apr 2005
    Posts
    200

    Question Mouseclicks over a listbox: JavaScript or Asp.Net?

    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/is...e/default.aspx

    Please advice

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,865

    Re: Mouseclicks over a listbox: JavaScript or Asp.Net?

    Well, to start the page off you could declare a JavaScript variable named mnuenabled and set it to false. Now use onmouseover and onmouseout for the items you want to be enabled on the menu. In that onmouseover routine set the mnuenabled to true and onmouseout should be set to return the variable to false. Now only show the right-click menu when the variable is true.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Nov 2006
    Posts
    4

    Re: Mouseclicks over a listbox: JavaScript or Asp.Net?

    Hi ZhiYi;
    Did you ever resolve this issue?

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,865

    Re: Mouseclicks over a listbox: JavaScript or Asp.Net?

    Welcome to the forums, joeller. This thread is over 6 years old!

    Please do not post over other people's questions. When you have a question, create a new thread and explain your problem.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center