Overview of Web Server Control

Overview of Web Server Control

The web server controls are mostly used components of ASP.NET 4.5.In ASP.NET 4.5, Web server controls work in a different way as they do not map to specific HTML elements, but they allow you to define functionality, capability, and appearance without the attributes that are available to you through a collection of HTML elements.

All web server controls use an “asp” prefix at the beginning of the control declaration in ASP.NET.

<asp:Label ID=”Label1″ runat=”server” Text=”Hello World”></asp:Label>

A web server controls require an ID attribute to reference the control in the server-side code, as well as a runat=”server” attribute declaration.

You can see that the <asp:Label> control has a closing </asp:Label> element associated with it above. You could have also closed this element using the following syntax:

<asp:Label ID=”Label1″ runat=”server” Text=”Hello World” />