asp.net.ph

Skip Navigation LinksHome > ASP.NET Web Forms > Web Forms Server Controls > Web Forms Server Controls overview

Web Forms Server Controls Overview

HTML Server Controls   Web Server Controls   Validation Controls   User Controls


Web Server Controls

Web server controls are custom ASP.NET controls with more built-in features than HTML server controls.

Web server controls include not only form-type controls such as text boxes and buttons, but also controls to display data-bound lists, and special-purpose controls such as a calendar, menu, treeview and ad rotator.

Web server controls are more abstract and flexible than HTML server controls, in that their object model does not necessarily reflect HTML syntax.

Web server controls are declared with an XML tag prefix that references the asp namespace.

 <asp:label ... runat="server" />

By assigning a unique id attribute to the control, the control’s methods and properties can then be accessed programmatically, using the control’s assigned name.

The below code snippet demonstrates how to dynamically set the Text property of a Label control as the page loads.

<script language="C#" runat="server">
   void Page_Load ( Object sender, EventArgs e ) {
      myCtrl.Text= "Today is " + DateTime.Now.ToString ( "f" );
   }
</script>
... 
<asp:label id="myCtrl" style="font-style:italic" runat="server" />
  C# VB JScript
Web Server Control Syntax Example
Run Sample | View Source

For an overview of the available ASP.NET Web controls, see Controls You Can Use on Web Forms.

More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note