Supressing Submit Behaviour

by Randall 3/30/2009 10:39:00 AM

Yesterday I needed to supress the submit functionality of some HtmlInputImage controls (aka <input type="submit" ... /> ) and found the answer with a bit of Googling.  I'm posting it here with what is (hopefully) a better heading for the solution.   Perhaps Google will index this page and make it easier for someone else to figure out.

In your form tag, use the following:

<form id="form1" runat="server" onsubmit="return false"

This will prevent the standard submit behaviour and allow your onclick JavaScript to run as you expected. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Randall Sexton
Currently a .Net developer for Bechtel Corporation in Oak Ridge, TN.

E-mail me Send mail

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Pages

    Recent comments

    Don't show

    Authors

    Categories


    Logo Credit

    My logo was taken from CodingHorror.
    Jeff Atwood © Copyright 2007

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in