Asp.net server side controls example

When we build web application using asp.net framework, we have both server side controls and client side controls, many times we use client side controls at server by writing "runat=server" attribute, but now there are all ready to use server side controls with lot more additional attribute and functionality, here we learn different type of server side controls in asp net with example.

Asp.net server side control tutorial

Controls are basically ready to use mechanism for building web application, they all are different in nature, and we can classify asp.net server side controls based on behaviour or purpose

Broadly we can classify them in following categories
  • HTML Controls
  • Asp.net Controls Server Side
  • Asp.net Ajax Control
  • User controls
  • Custom controls

All Asp.Net controls comes under System.Web.UI.WebControls Namespace, Here are the quick overviews

  • Asp.Net Form Controls:

    Form control is used for designing form on Asp.net web page. We can add both html control and asp.net control for data capture in side form control, in case of using html control we need to add runat=server property value , we normally place textbox, dropdown list, listbox, radio button, checkbox controls inside form control.

    This is how we define asp.net server side control
    <asp: textbox id=TextBox1 runat="Server" Text=" " text=" "> </asp:textbox>
    When we create a page in asp.net, the webform is created; we don’t need to write any additional form tag like HTML
  • Validation Controls
    Validation controls are used for validating user input; there are different types of validation control in asp.net application
    • RequiredFieldValidator
    • CompareValidator
    • RegularExpressionValidator
    • RangeValidator
    • ValidationSummary
    • CustomValidator
    All above validators are inherited from : BaseValidator class, These validation controls need support of jQuery to display error message on screen immediately
  • Master pages
    Master pages are very useful to make all application pages look similar; this is a type of template, very easy to use and helps maintaining consistency throughout the application
  • Data Controls

    There are many ready to use controls that allow dealing with collection of data, like displaying data, giving user an opportunity to manipulate data from UI, here are some popular data controls : GridView, Repeater, DataGrid, DataView, ListView, DataList

  • Navigation Controls

    Menu, TreeView, SiteMapPath

  • Login Controls

    Login, LoginView, PasswordRecovery, ChangePassword, CreateUserWizard

  • Ajax Control

    Ajax control comes with script manager and update panel, this allow us to create Ajax functionality, means anything we create within that panel, can make server side call without having any PostBack of entire page.

  • User Control

    User control is a additional part which can have one or multiple asp.net controls with a fix set of functionality, can be easily integrated in any webpage, we can consider this as part of page, user control comes with .ascx file extension, we need to register on web page wherever we want to use them.

  • Custom Control

    Custom controls are type of control that is developed on demand by us (developer); custom controls are deployed as individual assemblies; Custom controls has same life cycle like any other server side controls in asp.net.

    public class WelcomeCompositeControl : System.Web.UI.WebControls.WebControl, INamingContainer
    {
    
    }

    We can have multiple web controls in a custom control

You may be interested to read following posts


Asp.Net C# Examples | Join Asp.Net Course | Learn Asp.net MVC | Asp.net Core Tutorial