Main Page

  Previous Section Next Section


System.Web.UI (system.web.dll)class

This class represents a user control, or .ascx file, inside a Web Form. A user control allows you to share commonly used portions of user interface. User controls are similar to .aspx pages and can contain HTML, server controls, and event handling logic. They are instantiated and cached in much the same way as Page objects and contain many of the same properties. The difference is that user controls must be situated inside a Web Forms page. User controls should not be confused with custom web controls, which you can create by inheriting from System.Web.UI.WebControls.WebControl.

When using fragment caching with user controls, remember that you will not be able to modify any of the properties of the UserControl; the cached control will be loaded as straight HTML rather than a UserControl object.

public class UserControl : TemplateControl, IAttributeAccessor, IUserControlDesignerAccessor {
// Public Constructors
   public UserControl( );
// Public Instance Properties
   public HttpApplicationState Application{get; }
   public AttributeCollection Attributes{get; }
   public Cache Cache{get; }
   public bool IsPostBack{get; }
   public HttpRequest Request{get; }
   public HttpResponse Response{get; }
   public HttpServerUtility Server{get; }
   public HttpSessionState Session{get; }
   public TraceContext Trace{get; }
// Public Instance Methods
   public void DesignerInitialize( );
   public void InitializeAsUserControl(Page page);
   public string MapPath(string virtualPath);
// Protected Instance Methods
   protected override void LoadViewState(object savedState);    // overrides Control
   protected override void OnInit(EventArgs e);                 // overrides Control
   protected override object SaveViewState( );       // overrides Control


System.Object Control(System.ComponentModel.IComponent, System.IDisposable, IParserAccessor, IDataBindingsAccessor) TemplateControl(INamingContainer) UserControl(IAttributeAccessor, IUserControlDesignerAccessor)



      Previous Section Next Section