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

Discussion in 'ASP .Net Web Controls' started by Sam, Nov 13, 2008.

  1. Sam

    Sam Guest

    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
     
    Sam, Nov 13, 2008
    #1
    1. Advertising

  2. 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/


    Sam wrote:
    > 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
     
    Brian Kenneth Nielsen, Nov 25, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    1,718
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,237
    Ghafran Abbas
    Oct 12, 2004
  3. Marcin

    Button always renders as submit

    Marcin, Feb 7, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    827
    Anthony Williams
    Feb 8, 2005
  4. ChrisN
    Replies:
    3
    Views:
    493
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 4, 2007
  5. Marcin

    Button always renders as submit

    Marcin, Feb 7, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    128
    Anthony Williams
    Feb 8, 2005
Loading...

Share This Page