Page posting back twice
-
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 -
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, RCThis 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)
-
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, RCI 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', '');