why does HTML input button with runat="server" not cause postback?

Discussion in 'ASP .Net' started by Chris, Jun 10, 2007.

  1. Chris

    Chris Guest

    Hi,

    i 'm experimenting with postback and i tried that with a button server
    control and an Html input button but with runat="server".

    The button server control causes a postback, but not the Html input button
    with runat="server".

    Can someone explain me why (because it's running on the server)?
    Thanks
    Chris
    Chris, Jun 10, 2007
    #1
    1. Advertising

  2. runat="server" makes the control available for asp.net in the page life
    style, that is between the http request arrival and rendering the resulting
    html. It doesn't effect any client-side behavior. Button server control
    initiates postbacks not because of runat="server". Rather it comes with some
    built-in client-side code.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin


    "Chris" <> wrote in message
    news:...
    > Hi,
    >
    > i 'm experimenting with postback and i tried that with a button server
    > control and an Html input button but with runat="server".
    >
    > The button server control causes a postback, but not the Html input button
    > with runat="server".
    >
    > Can someone explain me why (because it's running on the server)?
    > Thanks
    > Chris
    >
    >
    Eliyahu Goldin, Jun 10, 2007
    #2
    1. Advertising

  3. Chris wrote:
    > Hi,
    >
    > i 'm experimenting with postback and i tried that with a button server
    > control and an Html input button but with runat="server".
    >
    > The button server control causes a postback, but not the Html input button
    > with runat="server".
    >
    > Can someone explain me why (because it's running on the server)?
    > Thanks
    > Chris
    >


    The Button control is rendered as an input with type="submit" in the
    html code, that's why it's doing a postback.

    The html input with type="button" doesn't do anything by itself. You
    have to add some Javascript in the onclick event for it to actually do
    anything at all.

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jun 11, 2007
    #3
  4. Chris

    bruce barker Guest

    only the html form controls <input type=submit> or <input type=image>
    postback. the <input type=button> is for firing client events without a
    postback.

    -- bruce (sqlwork.com)

    Eliyahu Goldin wrote:
    > runat="server" makes the control available for asp.net in the page life
    > style, that is between the http request arrival and rendering the resulting
    > html. It doesn't effect any client-side behavior. Button server control
    > initiates postbacks not because of runat="server". Rather it comes with some
    > built-in client-side code.
    >
    bruce barker, Jun 11, 2007
    #4
  5. Chris

    Chris Guest

    Thanks

    "Göran Andersson" <> schreef in bericht
    news:...
    > Chris wrote:
    >> Hi,
    >>
    >> i 'm experimenting with postback and i tried that with a button server
    >> control and an Html input button but with runat="server".
    >>
    >> The button server control causes a postback, but not the Html input
    >> button with runat="server".
    >>
    >> Can someone explain me why (because it's running on the server)?
    >> Thanks
    >> Chris

    >
    > The Button control is rendered as an input with type="submit" in the html
    > code, that's why it's doing a postback.
    >
    > The html input with type="button" doesn't do anything by itself. You have
    > to add some Javascript in the onclick event for it to actually do anything
    > at all.
    >
    > --
    > Göran Andersson
    > _____
    > http://www.guffa.com
    Chris, Jun 11, 2007
    #5
    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. Hazzard
    Replies:
    2
    Views:
    543
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  2. z. f.
    Replies:
    1
    Views:
    467
    Mikhail Arkhipov \(MSFT\)
    Jun 25, 2004
  3. Ryan
    Replies:
    4
    Views:
    8,993
    Chris Botha
    Nov 8, 2005
  4. Guy
    Replies:
    5
    Views:
    2,820
    brucie
    Dec 13, 2003
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,840
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page