Asp button with different button type Asp button with different button type asp.net asp.net

Asp button with different button type


You can just set UseSubmitBehavior="false" and it will render type="button" instead of type="submit" (.net 4 at least)


Using the attribute UseSubmitBehaviour="false" solved my problem

<asp:Button ID="button1" runat="server" UseSubmitBehavior="false" Text="just a button" />

This attribute is available since .Net v2.0, for more information: Button.UseSubmitBehavior Property


Two ways:

1) Add a OnClientClick property which returns false.

 <asp:Button runat="Server" ONClientClick="return true"/>

2) Or use a HTML Control i.e:

 <input type="button" id="testButton" value="Regular Button" runat="server"/>