Compare the benefits of using HTML Server controls with using HTML controls.
HTML controls are part of the HTML language. You can use and address them in client-side scripting but not from the server side.
From what I understand, almost every HTML control can be converted to a server control by using the <runat=”server”> tag in the HTML code on your ASPX code which signals the server that this control is server-side. On page load, the server control generates the code for the control and sends it to the browser.
HTML server controls have the advantage of retaining status (viewstate) - that means, the server knows if the checkbox is checked or not and if an option is selected or not. This is particularly helpful if you refresh a pages or go back to it. A regular HTML control would be reset to the state in the HTML code. An HTML server control on the other hand checks with the server and the server will tell the page, that the user had selected option B and that the name entered in the text field was Susanne. With an HTML server control, the code for the control and the code behind is executed on the server but it can interact with client-side code.
HTML server controls seem to be the in-between step between old-fashioned HTML controls which don’t do much and are purely client-side and fancier Web controls or ASP.NET controls. The resemble HTML controls and make the transition from a static HTML page to a server driven ASP page easier. ASP.NET controls are not based on HTML anymore and are basically a new programming language that you have to learn.
comments
Leave a Reply