You must Sign In to post a response.
  • Category: ASP.NET

    Difference between html control vs server controls

    Difference between html control vs server controls
  • #648478
    HTML controls cannot be programmed on the server whereas serverside controls can be programmed on server as it has runat="server" attribute.
    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #648483
    By default, When you drag an HTML control from the ToolBox, it will not have runat="server" attribute. So, without runat="server" you cannot access the control in code behind. However, you can add the runat="server" attribute to any HTML control. In such case it will be an HTML server control.

    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • #648511
    [Response removed by Admin. Read forum policies.]
    Kamlesh Mohanty

  • #648535
    HTML controls are the controls which is accessible only in the HTML page of the .net application whereas in server controls we have runat= "server" attribute which make it accessible from code also.

    However we can make HTML control accessible to the client side by adding the same runat="server "attribute.

    Microsoft Certified Technology Specialist
    MY Blog..

  • #648539
    An ASP.Net server control has a rich set of (server side) methods and/or properties and might not map to a single html element.

    An html server control is just the server side representation of one html element.

    HTML Server Controls:

    HTML elements in ASP.NET files are, by default, treated as text. To make these elements programmable, add a runat="server" attribute to the HTML element. This attribute indicates that the element should be treated as a server control.

    - All HTML server controls must be within a <form> tag with the runat="server" attribute!

    Server Controls:

    Like HTML server controls, Web server controls are also created on the server and they require a runat="server" attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements.

    The syntax for creating a server control is:

    <asp:TextBox id="text_id" runat="server" />

    With Regards

  • #648552
    HTML controls are client side controls, it would be formed in the client side

    But server side controls are processed in the server and the response would be rendered in a html format

    Please mark this as Answer, if this helps

    Alwyn Duraisingh.M 
    << Database Administrator >>
    Jesus saves! The rest of us better make backups...

  • #648582
    Unlike HTML controls, the HTML Server controls are programmable on the web server.

    Difference between HTML controls and HTML Server controls
    a. Runat="server" is added for HTML Server control. Eg: <input id="txtName" runat="server" type="text">

    Main Advantage of using HTML server control with is to provide a better migration path for existing web forms.

    Software Engg.

  • #648620
    HTML controls:
    1)Equivalent to standard HTML Elements
    2)Properties correspond to HTML attributes
    Server controls:
    1)Use asp:prefix and have run at="server" attribute
    2)Generate standard HTML
    3)Have custom Properties,events and methods
    4)ASP.Net Modifies HTML Generate based on browser and other conditions
    5)You can create custom controls


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.