Question on HTML and Web(Server Side) Controls

Discussion in 'ASP .Net Building Controls' started by Ralph Krausse, Sep 10, 2004.

  1. 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
     
    Ralph Krausse, Sep 10, 2004
    #1
    1. Advertising

  2. Ralph Krausse

    Joerg Jooss Guest

    Ralph Krausse wrote:
    > 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>


    WebControls such as Button offer a higher level abstraction than HTML
    controls. See for example the way you set each button's text. For the HTML
    control, you use its HTML attributes like "value" (which isn't terribly
    self-describing to developers not familiar with HTML), whereas the
    WebControl uses a property called "Text". If you wanted to set the button's
    color, you can simply set the Button.Color to an object of type Color. No
    such luck with <input />, where you have to dig out your HTML/CSS reference
    to set the style attribute to some CSS value.

    There are also WebControls that are a combination of many HTML elements,
    like the DataGrid, and do not have any counterparts as HTML controls.

    Which to use? That's an architectural question. When you have a lot existing
    HTML that you want to beef up with some server-side logic, HTML controls
    will get you started quickly, because you can add runt="server" to your
    existing pages and off you go. If you start from scratch, check which
    controls fulfill your requirements best. Note that you can easily mix both
    control families in your pages.

    Cheers,

    --
    Joerg Jooss
     
    Joerg Jooss, Sep 11, 2004
    #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. Matt
    Replies:
    14
    Views:
    4,106
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. Ralph Krausse
    Replies:
    2
    Views:
    430
  3. =?Utf-8?B?c2lhag==?=
    Replies:
    7
    Views:
    1,490
    =?Utf-8?B?c2lhag==?=
    Mar 7, 2005
  4. Ralph Krausse

    Question on HTML and Web(Server Side) Controls

    Ralph Krausse, Sep 10, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    109
    Ralph Krausse
    Sep 10, 2004
  5. brian

    HTML Server Controls vs Web Server Controls

    brian, Jan 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    310
    Steve C. Orr [MVP, MCSD]
    Jan 24, 2005
Loading...

Share This Page