asp button always rendered as type="button" vs. type="submit"

S

Sam

I have a User Control that renders all asp buttons as Command button
vs. Submit buttons. When you view source on the browser you see the
HTML rendered:

<input type="button" ... >

instead of

<input type="submit" ...>

I am aware there is a property for the button control named
UseSubmitBehavior. The default is true and I have explicitly set this
to true, but I still cannot get the button to render as a Submit
button. Has anyone seen this behavior and have a workaround?

Thanks,

Sam
 
B

Brian Kenneth Nielsen

Hi Sam

Why would you like a submit button?

ASP.Net only allows one server side form anyway. And if you have
multiple "forms" on the page, it will be a problem, if they all had
type=Submit buttons.

That's properly why you don't see a real submit button.

If you have the common problem about which button that is the default
button, then put your subform into a <asp:panel> and place your Command
Button inside that. then set asp:panels defaultButton property to the ID
of your Command Button. That way your button will be called when user
eg. press ENTER key in one of the forms fields.

In that way you can both a login form, search form, tip a friend form on
the same page, with different default buttons.

Best regards
Brian Kenneth Nielsen
http://www.bknnet.dk/
 

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

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top