Venerable Bede Posted February 10, 2003 Posted February 10, 2003 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? Quote
Netnoobie Posted February 10, 2003 Posted February 10, 2003 Just create a sub for the OnClick of that button. Put your code in the Sub (or Function if you want it to return something) and there you go. Hope that helps! Quote
Venerable Bede Posted February 10, 2003 Author Posted February 10, 2003 It doesnt work. No matter which button I hit it submits the form. AAARRRGGGHHH .net is driving me nuts. Quote
Moderators Robby Posted February 10, 2003 Moderators Posted February 10, 2003 ...I want the other button to execute some code without submitting the form... Do you want to execute the code on the server or client? If it's server you need to postback, if it's client then add an HTML button and use vbScript or JavaScript. Quote Visit...Bassic Software
bungpeng Posted February 11, 2003 Posted February 11, 2003 It is client site problem, not server site, so it is javascript or vbscript problem, not ASP.NET in VBScript, you can use "form_submit = false". in JavaScript, you can "onSubmit='return false'" in <FORM> tags. (you can write a function to return true/false and pass it to 'onSubmit' event) Quote
Moderators Robby Posted February 11, 2003 Moderators Posted February 11, 2003 bungpeng, if you are using an HTML button and just calling some routines, there is no reason to "form_submit = false", because it's not even a Submit button. Quote Visit...Bassic Software
bungpeng Posted February 11, 2003 Posted February 11, 2003 If you read carefully what 'Venerable Bede' mentioned, of course I assume there are 2 submit buttons rather than normal HTML buttons. (because it submitting the form) Quote
Leaders quwiltw Posted February 11, 2003 Leaders Posted February 11, 2003 I think what Robby is getting at is if he *does* have 2 submit buttons then he should probably change it to one submit button and one html button instead of "tricking" a submit button into not submitting. Quote --tim
Moderators Robby Posted February 11, 2003 Moderators Posted February 11, 2003 He has 2 ASP buttons, and if you read my first reply, I said change one to regular HTML button, this will allow you to run client side scripts (without submitting). yeah quwiltw got what I said. Quote Visit...Bassic Software
Leaders quwiltw Posted February 11, 2003 Leaders Posted February 11, 2003 Isn't that what I said? Oops... guess so:) Quote --tim
Moderators Robby Posted February 11, 2003 Moderators Posted February 11, 2003 quwiltw ... Yeah, I hadn't seen your post yet. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.