473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

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
Jun 10 '07 #1
4 13263
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" <cc@dd.ddwrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
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


Jun 10 '07 #2
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
Jun 11 '07 #3
only the html form controls <input type=submitor <input type=image>
postback. the <input type=buttonis 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.
Jun 11 '07 #4
Thanks

"Göran Andersson" <gu***@guffa.comschreef in bericht
news:uC**************@TK2MSFTNGP04.phx.gbl...
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

Jun 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim Mulholland | last post by:
I have one page where i have some <div> tags set to be runat="server" (and i've given them an id) and i can access them from the code-behind file just fine. I have another page where i've done...
3
by: Libra Blue | last post by:
I try to set the page title dynamically in an aspx page, but sometimes an error occurs due to VS removing the runat="server" attribute at its own will... How do I stop from doing so?? Libra Blue
6
by: Martin Eyles | last post by:
Hi, I have a page that contains the following <div runat="server" id="Pikea"> <object runat="server" id="PiTV" style="width:560px; height:560px"...
3
by: Jaime Stuardo | last post by:
Hi all... Both controls are server side. The former has more properties. Both may have associated events that are ran at server. Which one are recommended to use? is performance an issue? in...
4
by: Ryan | last post by:
Hello, I have a standard HTML button on an aspx web form that I have set to runat server. The button is named reset1 and its tag is as follows: <INPUT id="btnReset1" style="WIDTH: 60px;...
4
by: Kevin Blount | last post by:
bit long winded this one, so stick with me: I'm trying to create a form that can go to one of 3 places, depending on various elements. My form control looks like this: <form runat="server"...
2
by: Bob | last post by:
Hi, in aspx file, i defined this: <input id="Button2" type="button" value="button" runat="server" onclick="klik()"/> This 'onclick' event is a clientclick (starting the Javascript function...
0
by: Bob | last post by:
When I use an ASP:Label with runat="server", and in JavaScript I use innerText on the ASP:Label, the Text property is not reflected in an event postback on the form. ASP:TextBox is not an...
19
by: Scott M. | last post by:
Why do we need runat="server" on our <headtags?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.