Files
mono/mcs/class/System.Web/System.Web.UI/UserControl.cs
T
2002-07-15 00:56:02 +00:00

168 lines
2.6 KiB
C#

//
// System.Web.UI.UserControl
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
using System;
using System.Web.Caching;
using System.Web.SessionState;
namespace System.Web.UI
{
public class UserControl : TemplateControl, IAttributeAccessor
{
private bool initialized;
private AttributeCollection attributes;
public UserControl ()
{
//??
}
public HttpApplicationState Application
{
get {
Page p = Page;
if (p == null)
return null;
return p.Application;
}
}
public AttributeCollection Attributes
{
get {
if (attributes == null)
attributes = new AttributeCollection (new StateBag ());
return attributes;
}
}
public Cache Cache
{
get {
Page p = Page;
if (p == null)
return null;
return p.Cache;
}
}
public bool IsPostBack
{
get {
Page p = Page;
if (p == null)
return false;
return p.IsPostBack;
}
}
public HttpRequest Request
{
get {
Page p = Page;
if (p == null)
return null;
return p.Request;
}
}
public HttpResponse Response
{
get {
Page p = Page;
if (p == null)
return null;
return p.Response;
}
}
public HttpServerUtility Server
{
get {
Page p = Page;
if (p == null)
return null;
return p.Server;
}
}
public HttpSessionState Session
{
get {
Page p = Page;
if (p == null)
return null;
return p.Session;
}
}
public TraceContext Trace
{
get {
Page p = Page;
if (p == null)
return null;
return p.Trace;
}
}
[MonoTODO]
public void DesignerInitialize ()
{
throw new NotImplementedException ();
}
public void InitializeAsUserControl (Page page)
{
if (initialized)
return;
initialized = true;
FrameworkInitialize ();
}
[MonoTODO]
public string MapPath (string virtualPath)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override void LoadViewState (object savedState)
{
throw new NotImplementedException ();
}
protected override void OnInit (EventArgs e)
{
if (Page != null)
InitializeAsUserControl (Page);
base.OnInit(e);
}
[MonoTODO]
protected override object SaveViewState ()
{
throw new NotImplementedException ();
}
string IAttributeAccessor.GetAttribute (string name)
{
if (attributes == null)
return null;
return attributes [name];
}
void IAttributeAccessor.SetAttribute (string name, string value)
{
Attributes [name] = value;
}
}
}