Web Server Controls in ASP.NET

What is Web Server Controls?

ASP.NET provides web form controls that are used to create HTML components. And these Web Server Controls can detect browser capabilities. Web server controls in ASP.NET provides a rich object model.

And Web server controls have features like: automatic browser detection, postback, and event bubbling. And it also provides rich object model and type-safe programming. Like HTML server controls, the web server controls are also processed server-side by the ASP.NET engine. And these controls require a runat="server" attribute to work properly.

Web Server Control Syntax

<asp:controlTypeID="ControlID" runat="server" />


Example:

  • Button
  • TextBox
  • ListBox
  • Calendar
  • DataConnection
  • RadioButton


ASP.NET Web Controls are categorized as server and client base. Here are some server controls for the web forms:

  • TextBox
  • Button
  • LinkButton
  • Checkbox,  etc.


Most Web server controls are divided directly or indirectly from the base class. 

Web Control Base Class

Web Control Base Class inherits the methods and events of the WebControl base class of the  System.Web.UI.Control.WebControl namespace.

Here is the list of some common Web Server Controls included in ASP.NET:

Properties Description
AccessKey It is used to get or set the keyboard shortcut key that allows the user to quickly navigate the control.
BackColor This property is used to get or set the background color.
BorderColor This property is used to get or set the border color.
BorderWidth This property is used to get or set the border width.
Height This property is used to get or set the control's height.
Width This property is used to get or set the control's width.
CssClass This property represents the CSS class in which the Web Server control is rendered.
RunAt This property specifies that the code is to be run on the server and not on the client.

Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad