I have 2 asp.net buttons. One submits the form but I want the other button
to execute some code without submitting the form.
Is this possible and if so how?
Printable View
I have 2 asp.net buttons. One submits the form but I want the other button
to execute some code without submitting the form.
Is this possible and if so how?
You just put the code in the click event, and let the event return on it's own. Nothing special you have to do. The page will look like it was submitted, but it will just load up again with the same values as before (except password fields). On the actual submit button, you will process your code, then redirect the user to another page.
If you don't want the page to refresh (go back to the server to run the code), you are going to have to write the code in javascript or vbscript inside the pages html so it won't post back to the server to run the code.
...and don't forget to put your non-submit button's commands in a "If Is NotPostBack Then..." block.
I dont think it will work as Dreamweaver MX operates in a wierd fashion compared to Visual Studio.net.
dreamweaver MX is the devil when it comes to asp.net :)... well, i suppose it works, but i don't like it one bit compared to vs.net