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. jquery in asp.net+server side execution

jquery in asp.net+server side execution

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-netsysadmintutorial
7 Posts 2 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.
  • T Offline
    T Offline
    trilokharry
    wrote on last edited by
    #1

    Hi how to execute server side code in asp.net while using jquery. like some login form is opened by using jquery as model popup and how will be executed submit button click event. or any other way while using jquery to perform login form functionality. thanks

    You get the best out of others when you give the best of yourself.

    S 2 Replies Last reply
    0
    • T trilokharry

      Hi how to execute server side code in asp.net while using jquery. like some login form is opened by using jquery as model popup and how will be executed submit button click event. or any other way while using jquery to perform login form functionality. thanks

      You get the best out of others when you give the best of yourself.

      S Offline
      S Offline
      saini arun
      wrote on last edited by
      #2

      trilokharry wrote:

      execute server side code in asp.net while using jquery

      The most common method I use for this purpose is WebMethod. 1. Create a webmethod in your code behind.

      [System.Web.Services.WebMethod(EnableSession = true)]
      public static string DemoMethodInCodeBehind(string msg)
      {
      return "OK_" + msg;
      }

      2. Write a javascript function to call this web method.

      function demo()
      {
      PageMethods.DemoMethodInCodeBehind('hello',OnGetMessageSuccess, OnGetMessageFailure);
      }

      3. Implement success & failure methods in java script.

      function OnGetMessageSuccess(result, userContext, methodName)
      {
      alert("Success " + result);
      }

      function OnGetMessageFailure(error, userContext, methodName)
      {
      alert("Failed");
      }

      4. Now call Demo on button click.

      T 1 Reply Last reply
      0
      • T trilokharry

        Hi how to execute server side code in asp.net while using jquery. like some login form is opened by using jquery as model popup and how will be executed submit button click event. or any other way while using jquery to perform login form functionality. thanks

        You get the best out of others when you give the best of yourself.

        S Offline
        S Offline
        saini arun
        wrote on last edited by
        #3

        trilokharry wrote:

        like some login form is opened by using jquery as model popup and how will be executed submit button click event.

        The jQuery model popup displays the content of the DIV itself. I you use asp buttons inside your div to complete the login process you should have no problem accessing their _OnClick method in code behind.

        T 1 Reply Last reply
        0
        • S saini arun

          trilokharry wrote:

          like some login form is opened by using jquery as model popup and how will be executed submit button click event.

          The jQuery model popup displays the content of the DIV itself. I you use asp buttons inside your div to complete the login process you should have no problem accessing their _OnClick method in code behind.

          T Offline
          T Offline
          trilokharry
          wrote on last edited by
          #4

          button click event not getting executed. thanks for your kind reply.

          You get the best out of others when you give the best of yourself.

          S 1 Reply Last reply
          0
          • T trilokharry

            button click event not getting executed. thanks for your kind reply.

            You get the best out of others when you give the best of yourself.

            S Offline
            S Offline
            saini arun
            wrote on last edited by
            #5

            In that case you can go for page methods.

            1 Reply Last reply
            0
            • S saini arun

              trilokharry wrote:

              execute server side code in asp.net while using jquery

              The most common method I use for this purpose is WebMethod. 1. Create a webmethod in your code behind.

              [System.Web.Services.WebMethod(EnableSession = true)]
              public static string DemoMethodInCodeBehind(string msg)
              {
              return "OK_" + msg;
              }

              2. Write a javascript function to call this web method.

              function demo()
              {
              PageMethods.DemoMethodInCodeBehind('hello',OnGetMessageSuccess, OnGetMessageFailure);
              }

              3. Implement success & failure methods in java script.

              function OnGetMessageSuccess(result, userContext, methodName)
              {
              alert("Success " + result);
              }

              function OnGetMessageFailure(error, userContext, methodName)
              {
              alert("Failed");
              }

              4. Now call Demo on button click.

              T Offline
              T Offline
              trilokharry
              wrote on last edited by
              #6

              not getting exactly what to do with this code. I tried but no output. I'm new in jquery so please help me.

              You get the best out of others when you give the best of yourself.

              S 1 Reply Last reply
              0
              • T trilokharry

                not getting exactly what to do with this code. I tried but no output. I'm new in jquery so please help me.

                You get the best out of others when you give the best of yourself.

                S Offline
                S Offline
                saini arun
                wrote on last edited by
                #7

                Calling server side code does not have anything to do with jQuery. It can be achieve easily using javascript. http://www.dev102.com/2008/04/30/call-aspnet-webmethod-from-jquery/[^] http://www.xdevsoftware.com/blog/post/Call-WebMethod-from-Javascript-in-ASPNET.aspx[^]

                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