client side script

  • Thread starter Ricardo Silveira
  • Start date
R

Ricardo Silveira

I have a asp.net button in my webform. I want to run a custom client side
script (javascript) before submit the page and go to behindcode.
It doesn't have to pass by existing validator controls , i e,
CausesValidation="False";

Any help how to do that?

Thanks


Ricardo
 
R

Raterus

myButton.Attributes.Add("onClick", "javascript:someFunction();")

Even if you had validation on this button, you could still do this.
 
R

Ricardo Silveira

Thanks a lot!

It worked !

You know how this javascript function can eventually avoid submit the page?

Thanks agan!

Ricardo

myButton.Attributes.Add("onClick", "javascript:someFunction();")

Even if you had validation on this button, you could still do this.
 
M

Mythran

Avoid page submittal???

myButton.Attributes.Add("onClick", "javascript:return someFunction();")

Make sure someFunction() returns false to keep the form submittal from firing.

Mythran
 
V

Vidar Petursson

Hi

Don't add the Javascript bit

mySubmitBtn.Attributes.Add("onclick","return myHandler()");

return true/false from myHandler, false will cancel the submit
or use a regular button

--
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
==============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top