Share via


Types of Controls in ASP.NET

There are two types of user interface controls in ASP.NET, and the International Retail site uses both types of control as appropriate:

  • Custom Web controls

    Custom Web controls can be shipped as compiled assemblies. User interface rendering must be done manually through code. In addition to a standard set of properties, a custom Web control can have additional properties with richer design support.

    Custom Web controls inherit from system.web.UI.Webcontrols for their user interface, and then extend the functionality of their parent. For example, the countryselector control inherits from system.web.UI.WebControls.dropdownlist. For more information about Custom Web Controls, see the topic system.web.UI.Webcontrols Namespace in the .NET SDK documentation.

  • User controls

    A user control consists of a user interface page (with the extension .ascx) and the codebehind code. The user interface page and its code must be included into the ASP.NET application. User interface rendering is done automatically using the .ascx page. A user control can contain any number of other user controls or custom Web controls. A user control can have its own properties that can be set at design time, but there is little support for the site designer.

    User controls can have public properties that can be set in the containing page. These properties can control the appearance and behavior of the control. There are two advantages of having these public properties:

    • Properties can be set by the containing page at design time
    • Properties can be set programmatically at run time

See Also

Setting User Control Properties at Page Design Time

Setting User Control Properties Programmatically at Run Time

Copyright © 2005 Microsoft Corporation.
All rights reserved.