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. javascript communication with server controls?

javascript communication with server controls?

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptsysadmin
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
    sinanju
    wrote on last edited by
    #1

    Is it possible for javascript to communicate with server side controls? Say, how can i retrieve a server control (button)'s text from javascript? Im new to javascript, and i think that javascript is for only client side's stuff. and it is not possible for javascript to raise some server side events etc.

    M I 2 Replies Last reply
    0
    • S sinanju

      Is it possible for javascript to communicate with server side controls? Say, how can i retrieve a server control (button)'s text from javascript? Im new to javascript, and i think that javascript is for only client side's stuff. and it is not possible for javascript to raise some server side events etc.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Basically, the ASP.NET control renders to the html element at the client, so you can use javascript to access the rendered html button element. To do that you can have a look at the getElementById method of the document[^] object and the button's members[^]. Since you are new to javascript, this tutorial[^] can get you started.

      1 Reply Last reply
      0
      • S sinanju

        Is it possible for javascript to communicate with server side controls? Say, how can i retrieve a server control (button)'s text from javascript? Im new to javascript, and i think that javascript is for only client side's stuff. and it is not possible for javascript to raise some server side events etc.

        I Offline
        I Offline
        Ista
        wrote on last edited by
        #3

        Your right. Controls are server side only. And the java script is client side only. Although you could update the controls and force a postback. But that bad design, and a way to change the data on server side is always possible. 1 line of code equals many bugs. So don't write any!!

        S 1 Reply Last reply
        0
        • I Ista

          Your right. Controls are server side only. And the java script is client side only. Although you could update the controls and force a postback. But that bad design, and a way to change the data on server side is always possible. 1 line of code equals many bugs. So don't write any!!

          S Offline
          S Offline
          sinanju
          wrote on last edited by
          #4

          >>Although you could update the controls and force a postback How?

          I 1 Reply Last reply
          0
          • S sinanju

            >>Although you could update the controls and force a postback How?

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            Does this object extend the list control? If it does the AutoPostBack property will do it. Otherwise, javascript has a function "__doPostback" that will force it. Check out this link: http://www.dotnetspider.com/Technology/KBPages/195.aspx[^] 1 line of code equals many bugs. So don't write any!!

            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