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 a server side event from javascript

Call a server side event from javascript

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptsysadmin
4 Posts 4 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.
  • C Offline
    C Offline
    CrazyCoder26
    wrote on last edited by
    #1

    Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?

    ARINDAM

    B A V 3 Replies Last reply
    0
    • C CrazyCoder26

      Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?

      ARINDAM

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      You can do with AJAX.Please try Google :)

      Cheers!! Brij

      1 Reply Last reply
      0
      • C CrazyCoder26

        Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?

        ARINDAM

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Hi Arindam, Try to use CallBack and Ajax. Check This link http://www.codeproject.com/KB/aspnet/clientcallback.aspx[^]

        cheers, Abhijit Check My Latest Article

        1 Reply Last reply
        0
        • C CrazyCoder26

          Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?

          ARINDAM

          V Offline
          V Offline
          vb116
          wrote on last edited by
          #4

          Try this Javascript :

          __doPostBack('RAISE_Your_Event','specify_argument_here_if_needed');

          ASPX.CS Page_Load Event:

              if (this.IsPostBack)
              {
                  // Insure that the \_\_doPostBack() JavaScript method is created...
                  this.GetPostBackEventReference(this, string.Empty);
          
                  string eventTarget = (this.Request\["\_\_EVENTTARGET"\] == null) ? string.Empty : this.Request\["\_\_EVENTTARGET"\];
                  
          
                  if (eventTarget == "RAISE\_Your\_Event")
                  {
                      string argumentValue  =  (this.Request\["\_\_EVENTARGUMENT"\] == null) ? string.Empty : this.Request\["\_\_EVENTARGUMENT"\];
                  }
              }
          

          "Change is permanent, somethings never change!"

          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