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

C

Chris

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
 
E

Eliyahu Goldin

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.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Chris said:
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.
 
B

bruce barker

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)
 
C

Chris

Thanks

Göran Andersson said:
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.
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top