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. call javascript function from button

call javascript function from button

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettoolsquestion
4 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
    soneliso
    wrote on last edited by
    #1

    i have this button on my asp.net page, all i wanr with the button is to call a javascript function which is on a separate script. how can i called a function on the script called ValidateControl from clicking a button Thanks you vry much

    S 1 Reply Last reply
    0
    • S soneliso

      i have this button on my asp.net page, all i wanr with the button is to call a javascript function which is on a separate script. how can i called a function on the script called ValidateControl from clicking a button Thanks you vry much

      S Offline
      S Offline
      Sherin Iranimose
      wrote on last edited by
      #2

      Nothing different... Like you are calling an inline java script function.. in page load give Butten1.Attributes.Add("onclick","javascript:ValidateControl()") thats all


      To succeed, we must first believe that we can. Sherin Iranimose


      S G 2 Replies Last reply
      0
      • S Sherin Iranimose

        Nothing different... Like you are calling an inline java script function.. in page load give Butten1.Attributes.Add("onclick","javascript:ValidateControl()") thats all


        To succeed, we must first believe that we can. Sherin Iranimose


        S Offline
        S Offline
        soneliso
        wrote on last edited by
        #3

        Thank you very much, it works fine What you stand for, Put your life on

        1 Reply Last reply
        0
        • S Sherin Iranimose

          Nothing different... Like you are calling an inline java script function.. in page load give Butten1.Attributes.Add("onclick","javascript:ValidateControl()") thats all


          To succeed, we must first believe that we can. Sherin Iranimose


          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Sherin Iranimose wrote:

          in page load give Butten1.Attributes.Add("onclick","javascript:ValidateControl()")

          Only, you don't use the "javascript:" protocol when you don't put the code in an url. Button1.Attributes.Add("onclick","ValidateControl();") or in framework 2: Button1.OnClientClick = "ValidateControl();"

          --- single minded; short sighted; long gone;

          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