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. Is it possible link javascript with C# on ASP.net form

Is it possible link javascript with C# on ASP.net form

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-net
3 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.
  • P Offline
    P Offline
    phijophlip
    wrote on last edited by
    #1

    Hi Friends, Is it possible to link javascript with asp.net form. If the answer is yes , how will I make a linke between javascript and c# code on a ASP.NET form. :) -PHIJO MATHEW PHILIP. :)

    R S 2 Replies Last reply
    0
    • P phijophlip

      Hi Friends, Is it possible to link javascript with asp.net form. If the answer is yes , how will I make a linke between javascript and c# code on a ASP.NET form. :) -PHIJO MATHEW PHILIP. :)

      R Offline
      R Offline
      RichardGrimmer
      wrote on last edited by
      #2

      If you mean how to use a js file in an aspx, it's the same as it's always been - use a tag. If you mean can a js file call an aspx method, then yes - but only through Ajax...the other way round (aspx "calling" js functions), then google for RegisterClientScriptBlock / RegisterStartupScript

      "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

      1 Reply Last reply
      0
      • P phijophlip

        Hi Friends, Is it possible to link javascript with asp.net form. If the answer is yes , how will I make a linke between javascript and c# code on a ASP.NET form. :) -PHIJO MATHEW PHILIP. :)

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

        Of course, yes. This is the javascript. function sample(fieldId, title) { if (title == "") title = "Long Description"; document.Form1.submit(); } Code behind: this.btnSubmit.Attributes.Add("OnClick", "javascript:sample()"); rmr

        rmr

        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