Tuesday, November 4, 2008

User Controls v/s Custom Controls

User Controls
  • Custom, reusable controls created like forms
  • Reside in .ascx files
  • Can't be added to Visual Studio toolbox
  • Used either by dragging and dropping on an .aspx page or by adding manually with "@register" tag
  • Created by using existing Webserver and HTML server controls
  • The class is derived from System.Web.UI.UserControl class
Custom Control
  • Reusable controls
  • Developed by a developer or vendor
  • Derived from System.Web.UI.Control class for non-visual elements
  • Derived from System.Web.UI.WebControl class for visual interface
  • Deployed either in Bin directory or in Global Assembly Cache (GAC)