Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Calling a javascript method when an asp:menu menuItem is selected?

Calling a javascript method when an asp:menu menuItem is selected?

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve Holdorf
    wrote on last edited by
    #1

    I have a webpage with an asp:menu. I have menuItems in the menu. What I want to do is call a javascript function when the menuItem is selected but do not see an onselected or any selection event. Is there a way for me to just call a javascript function and not navigate to an url when the item is selected? Thanks, Steve

    C 1 Reply Last reply
    0
    • S Steve Holdorf

      I have a webpage with an asp:menu. I have menuItems in the menu. What I want to do is call a javascript function when the menuItem is selected but do not see an onselected or any selection event. Is there a way for me to just call a javascript function and not navigate to an url when the item is selected? Thanks, Steve

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I guess you need to look at the HTML that is generated, but I'd imagine if you make your 'url' javascript:myfunction()', that would work.

      Christian Graus Driven to the arms of OSX by Vista.

      S 1 Reply Last reply
      0
      • C Christian Graus

        I guess you need to look at the HTML that is generated, but I'd imagine if you make your 'url' javascript:myfunction()', that would work.

        Christian Graus Driven to the arms of OSX by Vista.

        S Offline
        S Offline
        Steve Holdorf
        wrote on last edited by
        #3

        When I add NavigateURL="javascript:function()" it only shows a page with the javascript source code? Note: this is an asp:menu. Thanks, Steve

        S 1 Reply Last reply
        0
        • S Steve Holdorf

          When I add NavigateURL="javascript:function()" it only shows a page with the javascript source code? Note: this is an asp:menu. Thanks, Steve

          S Offline
          S Offline
          Steve Holdorf
          wrote on last edited by
          #4

          O.K. I got it working! Thanks, Steve

          J 1 Reply Last reply
          0
          • S Steve Holdorf

            O.K. I got it working! Thanks, Steve

            J Offline
            J Offline
            JohnMcPherson1
            wrote on last edited by
            #5

            Ok, so let the rest of us know the secret...:confused:

            Regards, John McPherson "Sufficiently advanced technology is indistinguishable from magic." Arthur C. Clark, inventor of the telecommunications satellite

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups