Question on HTML and Web(Server Side) Controls

R

Ralph Krausse

I know more html is needed to really produce this but enough is here
for me to ask my question. So, this HTML code produce 2 buttons. One
button is a HTML control and the other is ASP Web or Server Control.
Why are there 2 ways to create buttons if they so the same thing? Do
they do the same thing? In what senario would I use a HTML button
rather than a Web control button. Does it matter? If not why 2
different controls that do the same thing.

<HTML>

<form id="Form1" method="post" runat="server">

<INPUT style="Z-INDEX: 101; LEFT: 104px; POSITION: absolute; TOP:
40px" type="button" value="Button1" id="Button2" name="Button2"
runat="server">

<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 104px; POSITION:
absolute; TOP: 88px" runat="server" Text="Button2"></asp:Button>
</form>

</HTML>


Thanks
Ralph Krausse

www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
 
S

SevDer

Ralph said:
I know more html is needed to really produce this but enough is here
for me to ask my question. So, this HTML code produce 2 buttons. One
button is a HTML control and the other is ASP Web or Server Control.
Why are there 2 ways to create buttons if they so the same thing? Do
they do the same thing? In what senario would I use a HTML button
rather than a Web control button. Does it matter? If not why 2
different controls that do the same thing.

<HTML>

<form id="Form1" method="post" runat="server">

<INPUT style="Z-INDEX: 101; LEFT: 104px; POSITION: absolute; TOP:
40px" type="button" value="Button1" id="Button2" name="Button2"
runat="server">

<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 104px; POSITION:
absolute; TOP: 88px" runat="server" Text="Button2"></asp:Button>
</form>

</HTML>


Thanks
Ralph Krausse

www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
For button it may be that you do not need web server control but
generally web controls will enable you to write browser independent code
(of course you can create little problems to yourself). And web controls
by default has viewstate enabled so any changes on them are preserved in
postbacks but if you are e.g. changing the text of the button, you need
to run the client code to change it all the time or, in the Page_Load
assing the value all the time. However if you have a web control you can
assing it once and it will stay there as long as you don't change it
agian. (A basic viewstate example)

But again, most of the time, it will help you to write browser
independent code as ASP.NET web controls handles this part for you.

I hope it was not too complicated.
 
K

Karl

What you are asking is why have System.Web.UI.WebControls and
System.Web.UI.HtmlControls? Specifically, why have the overlapping
controls?

The WebControls tend to provide more flexibility and power from a
development stand-point. They expose more properties, more events, and more
functionality. That's their raison d'être.

HtmlControls, exist because of how easily pure HTML/ASP can be converted to
them. Add a runat="server" and an id="xxx" and you can program against them
You won't have all the power of WebControls, but you'll get under way a lot
quicker.


Karl
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top