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. Calling __doPostBack()

Calling __doPostBack()

Scheduled Pinned Locked Moved ASP.NET
javascriptdatabasehelptutorial
7 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.
  • R Offline
    R Offline
    Radhakrishnan G
    wrote on last edited by
    #1

    How to trigger postback for a javascript // function Button1_onclick() { document.forms[0]['fileBrowse'].click(); document.forms[0]['TextBox1'].value = document.forms[0]['fileBrowse'].value; __doPostBack( 'TextBox1',''); } // this code showing an error "object expected" while debugging javascript :confused: Regards, Radhakrishnan

    S T 2 Replies Last reply
    0
    • R Radhakrishnan G

      How to trigger postback for a javascript // function Button1_onclick() { document.forms[0]['fileBrowse'].click(); document.forms[0]['TextBox1'].value = document.forms[0]['fileBrowse'].value; __doPostBack( 'TextBox1',''); } // this code showing an error "object expected" while debugging javascript :confused: Regards, Radhakrishnan

      S Offline
      S Offline
      SeMartens
      wrote on last edited by
      #2

      Hi, i'm not sure, but maybe you have to use

      document.getElementById()

      and the onclick doesn't seem correct:

      onclick="javascript:Button1_onclick();"

      Do you get the error on your server or on the client? Regards Sebastian

      It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

      R 1 Reply Last reply
      0
      • S SeMartens

        Hi, i'm not sure, but maybe you have to use

        document.getElementById()

        and the onclick doesn't seem correct:

        onclick="javascript:Button1_onclick();"

        Do you get the error on your server or on the client? Regards Sebastian

        It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

        R Offline
        R Offline
        Radhakrishnan G
        wrote on last edited by
        #3

        Error at client side on that __doPostBack()

        S 1 Reply Last reply
        0
        • R Radhakrishnan G

          Error at client side on that __doPostBack()

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

          You can use the Firefox error console to get the line and a detailed error message.

          It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

          1 Reply Last reply
          0
          • R Radhakrishnan G

            How to trigger postback for a javascript // function Button1_onclick() { document.forms[0]['fileBrowse'].click(); document.forms[0]['TextBox1'].value = document.forms[0]['fileBrowse'].value; __doPostBack( 'TextBox1',''); } // this code showing an error "object expected" while debugging javascript :confused: Regards, Radhakrishnan

            T Offline
            T Offline
            ToddHileHoffer
            wrote on last edited by
            #5

            document.getelementbyid('yourButtonId').click();

            I didn't get any requirements for the signature

            R 1 Reply Last reply
            0
            • T ToddHileHoffer

              document.getelementbyid('yourButtonId').click();

              I didn't get any requirements for the signature

              R Offline
              R Offline
              Radhakrishnan G
              wrote on last edited by
              #6

              Error is at line __doPostBack( 'TextBox1',''); "object expected"

              T 1 Reply Last reply
              0
              • R Radhakrishnan G

                Error is at line __doPostBack( 'TextBox1',''); "object expected"

                T Offline
                T Offline
                ToddHileHoffer
                wrote on last edited by
                #7

                That's not what I meant. Drag a button onto your form. Double click the button in design view to generate server side method. Add the following in the page_load (server side code) this.Button1.Style.Add("display", "none"); Add the following javascript to your page. function CallServerMethod() { var Button1 = document.getElementById("<%=Button1.ClientID %>"); Button1.click(); } In your javascript replace __doPostBack( 'TextBox1',''); with CallServerMethod() Add server side code to Button1_Click() event

                I didn't get any requirements for the signature

                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