tags:

views:

154

answers:

4

Hi all, Here I am again with another seemingly simple question I just cannot find the answer to. I would like to use an input type="button" but asp:Button always gives me a type="submit."

<asp:Button runat="server" bla bla bla />

Thanks in advance.

A: 

What do you want to do with the button?

You should probably just use an HTML button, not an ASP one.

Mystere Man
+4  A: 

An asp button is set up by default to post a page back to the server when it is clicked, which is why it is rendered as a submit button.

If you dont want a postback then there is no need to use the asp:button control

Regular html button should do the job:

 <input type="button" value="My Button"/>

you can still format html controls on the server

<input ID="MyButton" runat="server" type="button" value="My Button"/>
TStamper
This was a great answer. It was not the answer to my question, but it was a better answer to my problem than the answer to my question was. Thanks for looking past my ignorance to see what I needed.
Praesagus
+9  A: 

Use the following

<asp:Button ID="Button1" runat="server" Text="Button" UseSubmitBehavior="False" />

I tested it and it renders an <input type="button" />

ferrari fan
Kind of silly, IMO. Why not just use an HTML button?
Mystere Man
It is going in a table that is runat server and the compiler whines about non-asp html elements going in that table.
Praesagus
A: 

<asp:Button Text="SOMETHING NOT SUBMIT" runat="server" UseSubmitBehavior="False" />

Mr. Pig
-1 This doesn't actually produce a <input type="button" /> as asked by the OP, it produces an <input type="submit" />
bendewey