Microsoft recently made many changes to ASP.NET. In addition to being open source, ASP.NET 5 now enables developers to build web applications that run on Windows, Linux and Mac OS X. But the web framework still allows programmers to use three distinct types of server controls, i.e., HTML server controls, web server controls, and validation server controls.

  • ASP.NET treats the traditional HTML elements as text by default. But the developers can make the HTML elements programmable simply by adding runat=”server” attribute to make them understandable for the web server.
  • The programmers also have option to use ASP.NET web server components which are created on, and understood by the server. Unlike HTML server controls, web server controls can be used for representing more complex elements.
  • At the same time, the validation server controls make it easier for programmers to validate the input submitted by users. In case, the input submitted by the user fails to pass validation, the control will display the appropriate error message to him.

Overview of Commonly Used ASP.NET Server Controls
Buttons: ASP.NET allows programmers to use three distinct types of button controls. They can use button to display text in a rectangular area. Link button allow users to display text as a hyperlink, whereas image button enables developers to display images as buttons. Each time a user clicks on any of these three button controls, either Click or Command event is raised. Each button control also has common properties like text, AlternateText, ImageURL, CommandName, CommandArgument, and CausesValidation.

Textboxes: The developers can use Textboxes control to accept input from users. The control by default accepts one line of text. But the users can accept multiple lines of text by making changes to its TextMode attribute. The textbox controls has properties like Text, Wrap, Columns, Rows, Wrap, ReadOnly and MaxLength.

Labels: The programmers can use labels controls to display text on the web page. The control also allows them to display static text or customize the text programmatically at the time of page execution. The developers can format the label through its features like ForeColor, BackColor, BorderColor, BorderStyle, BorderWidth and Text. Likewise, they can set the Visible property of Label control as true or false to render it to the web page based on certain conditions.

Checkboxes: The checkboxes controls can be used for displaying multiple options to the user. The user also has option to check or uncheck each of these displayed options. The programmers can further avail several properties of the web server component including Text, Checked and GroupName. They can use the GroupName property to depict the name of the group the control belongs to. Likewise, the Checked property allows them to display checkboxes to users which are already selected in advance.

Radio Buttons: Unlike checkboxes, radio buttons can be used to display multiple values to the users, but the user will have option to select a single option. Radio buttons controls also have properties like Text, Checked and GroupName. The programmers can set the checked property as true to select the radio button at the time of displaying a form. They can even use the GroupName property to specify a name to a set of related radio buttons. The attribute helps developers to distinguish different groups of radio buttons used inside a single form.

Hyperlink Control: The web server control makes it easier for programmers to create hyperlinks in a number of ways. They can use the control in a manner similar to the element in HTML. Otherwise, they can use the control to create and display hyperlinks dynamically. Also, they can avail several properties of the hyperlink control including Text, Target, ImageURL and NavigateURL.

Image Control: The simple web control makes it easier for programmers to display images on a web page. They also have option to display specific text to users in case the image is not available. The control also has useful properties like ImageURL, ImageAlign and AlternateText. Also, the developers have option to use the control to display images on a web page by writing code.

List Controls: ASP.NET allows web programmers to use five distinct types of list controls. The developers have option to use bulleted list, list box, drop-down list, checkbox list, or radio button list control. Each of these controls allows users to select a single or multiple values. The developers can load these list controls either by writing code or using the ListItemCollection editor. These controls have a number of common properties like Text, Value and Selected. However, each control also has properties that are completely different from other list controls types.

While using the ASP.NET programmers also have option to create custom and reusable controls. Hence, they can create user controls and embed them into ASP.NET page to accomplish specialized tasks. Also, they can define the properties and methods for each user control, and add existing web server controls to the new server controls.

Comments

comments