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:

Related posts

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

9/4/2010 9:16:25 AM

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

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

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