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. Page posting back twice

Page posting back twice

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

    Hello, For some reason, when one particular button on a web page is clicked, the page posts back twice. Does anybody have any idea what would cause this? Here are some specifics about my code: I have 2 buttons. One button is an invisible server control button. The other is a visible html button. When the html button is clicked, I want it to run the postback code for the other button if certain conditions are met. function CheckParams() { if(head==false) { alert("Please select a heading."); } else { __doPostBack('SaveImp', ''); } } In general, the code works. I just can't figure out what would make the post back happen twice. Thanks, RC

    J G 2 Replies Last reply
    0
    • C chubbysilk

      Hello, For some reason, when one particular button on a web page is clicked, the page posts back twice. Does anybody have any idea what would cause this? Here are some specifics about my code: I have 2 buttons. One button is an invisible server control button. The other is a visible html button. When the html button is clicked, I want it to run the postback code for the other button if certain conditions are met. function CheckParams() { if(head==false) { alert("Please select a heading."); } else { __doPostBack('SaveImp', ''); } } In general, the code works. I just can't figure out what would make the post back happen twice. Thanks, RC

      J Offline
      J Offline
      Javier Lozano
      wrote on last edited by
      #2

      This seems to be a "long way" of doing this. Have you thought of just making the button visible and using RequiredFieldValidators? This will make things a bit more ".NET" compliant. ~javier lozano (blog)

      1 Reply Last reply
      0
      • C chubbysilk

        Hello, For some reason, when one particular button on a web page is clicked, the page posts back twice. Does anybody have any idea what would cause this? Here are some specifics about my code: I have 2 buttons. One button is an invisible server control button. The other is a visible html button. When the html button is clicked, I want it to run the postback code for the other button if certain conditions are met. function CheckParams() { if(head==false) { alert("Please select a heading."); } else { __doPostBack('SaveImp', ''); } } In general, the code works. I just can't figure out what would make the post back happen twice. Thanks, RC

        G Offline
        G Offline
        Gavin Jeffrey
        wrote on last edited by
        #3

        I stand to be corrected on this one but I think - anytime a button is clicked on a page a postback happens before the button event happens i.e. page_load then button_click so it posts back and then in your code you are telling it to do post back again __doPostBack('SaveImp', '');

        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