소스 검색

2003-07-17 Andreas Nahr <[email protected]>

	* IUserControlDesignerAccessor.cs: Added and implemented
	* Control.cs: Missing member added, added all attributes
	* Page.cs: Added attributes, fixed signature
	* TemplateControl.cs: Fixed signature, added all attributes
	* UserControl.cs: Added all attributes, added and implemented missing interface

svn path=/trunk/mcs/; revision=16355
Andreas N 22 년 전
부모
커밋
daa87f5920

+ 8 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,11 @@
+2003-07-17  Andreas Nahr <[email protected]>
+
+	* IUserControlDesignerAccessor.cs: Added and implemented
+	* Control.cs: Missing member added, added all attributes
+	* Page.cs: Added attributes, fixed signature
+	* TemplateControl.cs: Fixed signature, added all attributes
+	* UserControl.cs: Added all attributes, added and implemented missing interface
+	
 2003-07-17  Gonzalo Paniagua Javier <[email protected]>
 
 	* ControlCollection.cs: fixed bug #46472.

+ 95 - 29
mcs/class/System.Web/System.Web.UI/Control.cs

@@ -2,8 +2,9 @@
 // System.Web.UI.Control.cs
 //
 // Authors:
-// 	Bob Smith <[email protected]>
-// 	Gonzalo Paniagua Javier ([email protected])
+//   Bob Smith <[email protected]>
+//   Gonzalo Paniagua Javier ([email protected])
+//   Andreas Nahr ([email protected])
 //
 // (C) Bob Smith
 // (c) 2002 Ximian, Inc. (http://www.ximian.com)
@@ -81,12 +82,18 @@
 
 using System;
 using System.Collections;
-using System.ComponentModel;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
 using System.Web;
 using System.Web.Util;
 
 namespace System.Web.UI
-{
+{
+	[DefaultProperty ("ID"), DesignerCategory ("Code"), ToolboxItemFilter ("System.Web.UI", ToolboxItemFilterType.Require)]
+	[ToolboxItem ("System.Web.UI.Design.WebControlToolboxItem, " + Consts.AssemblySystem_Design)]
+	[Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+	[DesignerSerializer ("Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
         public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
         {
                 private static readonly object DataBindingEvent = new object();
@@ -129,7 +136,9 @@ namespace System.Web.UI
                 {
                         if (this is INamingContainer) _isNamingContainer = true;
                 }
-
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
 		public Control BindingContainer
 		{
 			get {
@@ -139,7 +148,10 @@ namespace System.Web.UI
 				return container;
 			}
 		}
-		
+		
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("An Identification of the control that is rendered.")]
 		public virtual string ClientID {
 			get {
 				string client = UniqueID;
@@ -150,7 +162,10 @@ namespace System.Web.UI
 				return client;
 			}
 		}
-
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("The child controls of this control.")]
                 public virtual ControlCollection Controls //DIT
                 {
                         get
@@ -158,7 +173,10 @@ namespace System.Web.UI
                                 if (_controls == null) _controls = CreateControlCollection();
                                 return _controls;
                         }
-                }
+                }
+
+		[DefaultValue (true), WebCategory ("FIXME")]
+		[WebSysDescription ("An Identification of the control that is rendered.")]
                 public virtual bool EnableViewState //DIT
                 {
                         get
@@ -170,7 +188,9 @@ namespace System.Web.UI
                                 _enableViewState = value;
                         }
                 }
-		
+		
+		[MergableProperty (false), ParenthesizePropertyName (true)]
+		[WebSysDescription ("The name of the control that is rendered.")]
                 public virtual string ID {
                         get {
                                 return _userId;
@@ -184,7 +204,10 @@ namespace System.Web.UI
 				NullifyUniqueID ();
                         }
                 }
-		
+		
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("The container that this control is part of. The control's name has to be unique within the container.")]
                 public virtual Control NamingContainer //DIT
                 {
                         get
@@ -198,7 +221,11 @@ namespace System.Web.UI
                                 }
                                 return _namingContainer;
                         }
-                }
+                }
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("The webpage that this control resides on.")]
                 public virtual Page Page //DIT
                 {
                         get
@@ -210,14 +237,22 @@ namespace System.Web.UI
                         {
                                 _page = value;
                         }
-                }
+                }
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("The parent control of this control.")]
                 public virtual Control Parent //DIT
                 {
                         get
                         {
                                 return _parent;
                         }
-                }
+                }
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsable (EditorBrowsableState.Advanced), Browsable (false)]
+		[WebSysDescription ("The site this control is part of.")]
                 public ISite Site //DIT
                 {
                         get
@@ -229,11 +264,17 @@ namespace System.Web.UI
                                 _site = value;
                         }
                 }
-
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("A virtual directory containing the parent of the control.")]
                 public virtual string TemplateSourceDirectory {
                         get { return (_parent == null) ? String.Empty : _parent.TemplateSourceDirectory; }
                 }
-
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		[WebSysDescription ("The unique ID of the control.")]
                 public virtual string UniqueID {
                         get {
 				if (uniqueID != null)
@@ -255,7 +296,10 @@ namespace System.Web.UI
 				uniqueID = prefix + ":" + _userId;
 				return uniqueID;
                         }
-                }
+                }
+
+		[DefaultValue (true), Bindable (true), WebCategory ("FIXME")]
+		[WebSysDescription ("Visiblity state of the control.")]
                 public virtual bool Visible
                 {
                         get
@@ -437,7 +481,16 @@ namespace System.Web.UI
                                 ChildControlsCreated = true;
 				creatingControls = false;
                         }
-                }
+                }
+
+		protected bool IsLiteralContent()
+		{
+			if (_controls != null) 
+				if (_controls.Count == 1)
+					if (_controls[0] is LiteralControl)
+						return true;
+			return false;
+		}
 
                 public virtual Control FindControl (string id)
                 {
@@ -597,11 +650,13 @@ namespace System.Web.UI
                         }
                 }
 
-		public bool HasChildren
+		internal bool HasChildren
 		{
 			get { return (_controls != null && _controls.Count > 0); }
 		}
-
+
+		[WebCategory ("FIXME")]
+		[WebSysDescription ("Raised when the contols databound properties are evaluated.")]
                 public event EventHandler DataBinding //DIT
                 {
                         add
@@ -612,7 +667,9 @@ namespace System.Web.UI
                         {
                                 Events.RemoveHandler(DataBindingEvent, value);
                         }
-                }
+                }
+
+		[WebSysDescription ("Raised when the contol is disposed.")]
                 public event EventHandler Disposed //DIT
                 {
                         add
@@ -623,7 +680,9 @@ namespace System.Web.UI
                         {
                                 Events.RemoveHandler(DisposedEvent, value);
                         }
-                }
+                }
+
+		[WebSysDescription ("Raised when the page containing the control is initialized.")]
                 public event EventHandler Init //DIT
                 {
                         add
@@ -634,7 +693,9 @@ namespace System.Web.UI
                         {
                                 Events.RemoveHandler(InitEvent, value);
                         }
-                }
+                }
+
+		[WebSysDescription ("Raised after the page containing the control has been loaded.")]
                 public event EventHandler Load //DIT
                 {
                         add
@@ -645,7 +706,9 @@ namespace System.Web.UI
                         {
                                 Events.RemoveHandler(LoadEvent, value);
                         }
-                }
+                }
+
+		[WebSysDescription ("Raised before the page containing the control is rendered.")]
                 public event EventHandler PreRender //DIT
                 {
                         add
@@ -656,7 +719,9 @@ namespace System.Web.UI
                         {
                                 Events.RemoveHandler(PreRenderEvent, value);
                         }
-                }
+                }
+
+		[WebSysDescription ("Raised when the page containing the control is unloaded.")]
                 public event EventHandler Unload //DIT
                 {
                         add
@@ -707,7 +772,8 @@ namespace System.Web.UI
 			HttpResponse resp = Context.Response;
 			return resp.ApplyAppPathModifier (UrlUtils.Combine (ts, relativeUrl));
                 }
-
+
+		[EditorBrowsable (EditorBrowsableState.Advanced)]
                 public void SetRenderMethodDelegate(RenderMethod renderMethod) //DIT
                 {
 			WebTrace.PushContext ("Control.AddParsedSubobject ()");
@@ -717,7 +783,7 @@ namespace System.Web.UI
 			WebTrace.PopContext ();
                 }
 
-                protected void LoadRecursive()
+                internal void LoadRecursive()
                 {
                         OnLoad (EventArgs.Empty);
                         if (_controls != null) {
@@ -727,7 +793,7 @@ namespace System.Web.UI
 			loaded = true;
                 }
 
-                protected void UnloadRecursive(Boolean dispose)
+                internal void UnloadRecursive(Boolean dispose)
                 {
                         if (_controls != null) {
 				foreach (Control c in _controls)
@@ -739,7 +805,7 @@ namespace System.Web.UI
 				Dispose();
                 }
 
-                protected void PreRenderRecursiveInternal()
+                internal void PreRenderRecursiveInternal()
                 {
 			if (_visible) {
 				EnsureChildControls ();
@@ -753,7 +819,7 @@ namespace System.Web.UI
 			prerendered = true;
                 }
 
-                protected void InitRecursive(Control namingContainer)
+                internal void InitRecursive(Control namingContainer)
                 {
                         if (_controls != null) {
 				if (_isNamingContainer)

+ 17 - 0
mcs/class/System.Web/System.Web.UI/IUserControlDesignAccessor.cs

@@ -0,0 +1,17 @@
+//
+// System.Web.UI.IUserControlDesignerAccessor.cs
+//
+// Author:
+//   Andreas Nahr ([email protected])
+//
+// (C) 2003 Andreas Nahr
+//
+
+namespace System.Web.UI
+{
+	public interface IUserControlDesignerAccessor
+        {
+                string InnerText { get; set; }
+		string TagName { get; set; }
+        }
+}

+ 91 - 12
mcs/class/System.Web/System.Web.UI/Page.cs

@@ -1,9 +1,10 @@
 //
-// System.Web.UI.Page
+// System.Web.UI.Page.cs
 //
 // Authors:
-//	Duncan Mak  ([email protected])
-//	Gonzalo Paniagua ([email protected])
+//   Duncan Mak  ([email protected])
+//   Gonzalo Paniagua ([email protected])
+//   Andreas Nahr ([email protected])
 //
 // (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
 //
@@ -11,6 +12,9 @@
 using System;
 using System.Collections;
 using System.Collections.Specialized;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
 using System.IO;
 using System.Security.Principal;
 using System.Text;
@@ -22,6 +26,11 @@ using System.Web.Util;
 namespace System.Web.UI
 {
 
+// TODO FIXME missing the IRootDesigner Attribute
+[DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
+[ToolboxItem (false)]
+[Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+[RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
 public class Page : TemplateControl, IHttpHandler
 {
 	private string _culture;
@@ -64,27 +73,36 @@ public class Page : TemplateControl, IHttpHandler
 
 	#region Properties
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public HttpApplicationState Application
 	{
 		get { return _context.Application; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected bool AspCompatMode
 	{
 		set { throw new NotImplementedException (); }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected bool Buffer
 	{
 		set { Response.BufferOutput = value; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public Cache Cache
 	{
 		get { return _context.Cache; }
 	}
 
 	[MonoTODO]
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false), DefaultValue ("")]
+	[WebSysDescription ("Value do override the automatic browser detection and force the page to use the specified browser.")]
 	public string ClientTarget
 	{
 		get { throw new NotImplementedException (); }
@@ -92,12 +110,14 @@ public class Page : TemplateControl, IHttpHandler
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected int CodePage
 	{
 		set { throw new NotImplementedException (); }
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected string ContentType
 	{
 		set { throw new NotImplementedException (); }
@@ -108,29 +128,36 @@ public class Page : TemplateControl, IHttpHandler
 		get { return _context; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected string Culture
 	{
 		set { _culture = value; }
 	}
 
+	[Browsable (false)]
 	public override bool EnableViewState
 	{
 		get { return _viewState; }
 		set { _viewState = value; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected bool EnableViewStateMac
 	{
 		get { return _viewStateMac; }
 		set { _viewStateMac = value; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false), DefaultValue ("")]
+	[WebSysDescription ("The URL of a page used for error redirection.")]
 	public string ErrorPage
 	{
 		get { return _errorPage; }
 		set { _errorPage = value; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected ArrayList FileDependencies
 	{
 		set {
@@ -139,12 +166,15 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
+	[Browsable (false)]
 	public override string ID
 	{
 		get { return _ID; }
 		set { _ID = value; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public bool IsPostBack
 	{
 		get {
@@ -152,35 +182,46 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
 	public bool IsReusable {
 		get { return false; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public bool IsValid
 	{
 		get { return _isValid; }
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected int LCID {
 		set { throw new NotImplementedException (); }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public HttpRequest Request
 	{
 		get { return _context.Request; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public HttpResponse Response
 	{
 		get { return _context.Response; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected string ResponseEncoding
 	{
 		set { Response.ContentEncoding = Encoding.GetEncoding (value); }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public HttpServerUtility Server
 	{
 		get {
@@ -188,47 +229,60 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public virtual HttpSessionState Session
 	{
 		get { return _context.Session; }
 	}
 
+	[Browsable (false)]
 	public bool SmartNavigation
 	{
 		get { return _smartNavigation; }
 		set { _smartNavigation = value; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public TraceContext Trace
 	{
 		get { return _trace; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected bool TraceEnabled
 	{
 		set { _traceEnabled = value; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected TraceMode TraceModeValue
 	{
 		set { _traceModeValue = value; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected int TransactionMode
 	{
 		set { _transactionMode = value; }
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected string UICulture
 	{
 		set { _UICulture = value; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public IPrincipal User
 	{
 		get { return _context.User; }
 	}
 
+	[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+	[Browsable (false)]
 	public ValidatorCollection Validators
 	{
 		get { 
@@ -238,6 +292,7 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
+	[Browsable (false)]
 	public override bool Visible
 	{
 		get { return base.Visible; }
@@ -249,6 +304,7 @@ public class Page : TemplateControl, IHttpHandler
 	#region Methods
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
 							     AsyncCallback cb, 
 							     object extraData)
@@ -257,22 +313,26 @@ public class Page : TemplateControl, IHttpHandler
 	}
 
 	[MonoTODO]
-	protected void AspcompatEndProcessRequest (IAsyncResult result)
+	[EditorBrowsable (EditorBrowsableState.Never)]
+	protected void AspCompatEndProcessRequest (IAsyncResult result)
 	{
 		throw new NotImplementedException ();
 	}
 	
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	protected virtual HtmlTextWriter CreateHtmlTextWriter (TextWriter tw)
 	{
 		return new HtmlTextWriter (tw);
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	public void DesignerInitialize ()
 	{
 		throw new NotImplementedException ();
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	protected virtual NameValueCollection DeterminePostBackMode ()
 	{
 		if (_context == null)
@@ -295,21 +355,25 @@ public class Page : TemplateControl, IHttpHandler
 		return coll;
 	}
 	
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public string GetPostBackClientEvent (Control control, string argument)
 	{
 		return GetPostBackEventReference (control, argument);
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public string GetPostBackClientHyperlink (Control control, string argument)
 	{
 		return "javascript:" + GetPostBackEventReference (control, argument);
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public string GetPostBackEventReference (Control control)
 	{
 		return GetPostBackEventReference (control, "");
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public string GetPostBackEventReference (Control control, string argument)
 	{
 		RequiresPostBackScript ();
@@ -321,12 +385,14 @@ public class Page : TemplateControl, IHttpHandler
 		requiresPostBackScript = true;
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	public virtual int GetTypeHashCode ()
 	{
 		return 0;
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	protected virtual void InitOutputCache (int duration,
 						string varyByHeader,
 						string varyByCustom,
@@ -335,7 +401,8 @@ public class Page : TemplateControl, IHttpHandler
 	{
 		throw new NotImplementedException ();
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public bool IsClientScriptBlockRegistered (string key)
 	{
 		if (clientScriptBlocks == null)
@@ -343,7 +410,8 @@ public class Page : TemplateControl, IHttpHandler
 
 		return clientScriptBlocks.ContainsKey (key);
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public bool IsStartupScriptRegistered (string key)
 	{
 		if (startupScriptBlocks == null)
@@ -480,6 +548,7 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Never)]
 	public void ProcessRequest (HttpContext context)
 	{
 		_context = context;
@@ -520,7 +589,7 @@ public class Page : TemplateControl, IHttpHandler
 		WebTrace.WriteLine ("End");
 		WebTrace.PopContext ();
 	}
-
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	internal void RaisePostBackEvents ()
 	{
 		if (requiresRaiseEvent != null) {
@@ -561,11 +630,13 @@ public class Page : TemplateControl, IHttpHandler
 	}
 	
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public void RegisterArrayDeclaration (string arrayName, string arrayValue)
 	{
 		throw new NotImplementedException ();
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void RegisterClientScriptBlock (string key, string script)
 	{
 		if (IsClientScriptBlockRegistered (key))
@@ -576,7 +647,8 @@ public class Page : TemplateControl, IHttpHandler
 
 		clientScriptBlocks.Add (key, script);
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
 	{
 		if (hiddenFields == null)
@@ -593,11 +665,13 @@ public class Page : TemplateControl, IHttpHandler
 	}
 
 	[MonoTODO]
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public void RegisterOnSubmitStatement (string key, string script)
 	{
 		throw new NotImplementedException ();
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public void RegisterRequiresPostBack (Control control)
 	{
 		if (_requiresPostBack == null)
@@ -606,11 +680,13 @@ public class Page : TemplateControl, IHttpHandler
 		_requiresPostBack.Add (control.ID);
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void RegisterRequiresRaiseEvent (IPostBackEventHandler control)
 	{
 		requiresRaiseEvent = control;
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void RegisterStartupScript (string key, string script)
 	{
 		if (IsStartupScriptRegistered (key))
@@ -622,6 +698,7 @@ public class Page : TemplateControl, IHttpHandler
 		startupScriptBlocks.Add (key, script);
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public void RegisterViewStateHandler ()
 	{
 		handleViewState = true;
@@ -631,7 +708,8 @@ public class Page : TemplateControl, IHttpHandler
 	{
 		_savedViewState = viewState;
 	}
-	
+
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	protected virtual object LoadPageStateFromPersistenceMedium ()
 	{
 		NameValueCollection postdata = DeterminePostBackMode ();
@@ -694,6 +772,7 @@ public class Page : TemplateControl, IHttpHandler
 			_isValid = true;
 	}
 
+	[EditorBrowsable (EditorBrowsableState.Advanced)]
 	public virtual void VerifyRenderingInServerForm (Control control)
 	{
 		if (!renderingForm)

+ 12 - 3
mcs/class/System.Web/System.Web.UI/TemplateControl.cs

@@ -2,14 +2,16 @@
 // System.Web.UI.TemplateControl.cs
 //
 // Authors:
-// 	Duncan Mak  ([email protected])
-// 	Gonzalo Paniagua Javier ([email protected])
+//   Duncan Mak  ([email protected])
+//   Gonzalo Paniagua Javier ([email protected])
+//   Andreas Nahr ([email protected])
 //
 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
 //
 
 using System;
 using System.Collections;
+using System.ComponentModel;
 using System.Reflection;
 using System.Web.Compilation;
 using System.Web.Util;
@@ -60,7 +62,7 @@ namespace System.Web.UI {
 		}
 
 		[MonoTODO]
-		protected virtual LiteralControl CreateResourceBasedLiteralControl (int offset,
+		protected LiteralControl CreateResourceBasedLiteralControl (int offset,
 										    int size,
 										    bool fAsciiOnly)
 		{
@@ -101,6 +103,7 @@ namespace System.Web.UI {
 			}
 		}
 
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		protected virtual void FrameworkInitialize ()
 		{
 		}
@@ -156,18 +159,21 @@ namespace System.Web.UI {
 		}
 
 		[MonoTODO]
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		public static object ReadStringResource (Type t)
 		{
 			return null;
 		}
 
 		[MonoTODO]
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		protected void SetStringResourcePointer (object stringResourcePointer,
 							 int maxResourceOffset)
 		{
 		}
 
 		[MonoTODO]
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		protected void WriteUTF8ResourceString (HtmlTextWriter output, int offset,
 							int size, bool fAsciiOnly)
 		{
@@ -177,16 +183,19 @@ namespace System.Web.UI {
 
 		#region Events
 
+		[WebSysDescription ("Raised when the user aborts a transaction.")]
 		public event EventHandler AbortTransaction {
 			add { Events.AddHandler (abortTransaction, value); }
 			remove { Events.RemoveHandler (abortTransaction, value); }
 		}
 
+		[WebSysDescription ("Raised when the user initiates a transaction.")]
 		public event EventHandler CommitTransaction {
 			add { Events.AddHandler (commitTransaction, value); }
 			remove { Events.RemoveHandler (commitTransaction, value); }
 		}
 
+		[WebSysDescription ("Raised when an exception occurs that cannot be handled.")]
 		public event EventHandler Error {
 			add { Events.AddHandler (error, value); }
 			remove { Events.RemoveHandler (error, value); }

+ 53 - 3
mcs/class/System.Web/System.Web.UI/UserControl.cs

@@ -1,19 +1,27 @@
 //
-// System.Web.UI.UserControl
+// System.Web.UI.UserControl.cs
 //
 // Authors:
-//	Gonzalo Paniagua Javier ([email protected])
+//   Gonzalo Paniagua Javier ([email protected])
+//   Andreas Nahr ([email protected])
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
 //
 using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
 using System.Web.Caching;
 using System.Web.SessionState;
 
 namespace System.Web.UI
 {
 	[ControlBuilder (typeof (UserControlControlBuilder))]
-	public class UserControl : TemplateControl, IAttributeAccessor
+	[DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
+	[ToolboxItem (false)]
+	[Designer ("System.Web.UI.Design.UserControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+	[RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
+	public class UserControl : TemplateControl, IAttributeAccessor, IUserControlDesignerAccessor
 	{
 		private bool initialized;
 		private AttributeCollection attributes;
@@ -24,6 +32,8 @@ namespace System.Web.UI
 			//??
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public HttpApplicationState Application
 		{
 			get {
@@ -44,6 +54,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public AttributeCollection Attributes
 		{
 			get {
@@ -51,6 +63,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public Cache Cache
 		{
 			get {
@@ -61,6 +75,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public bool IsPostBack
 		{
 			get {
@@ -71,6 +87,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public HttpRequest Request
 		{
 			get {
@@ -81,6 +99,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public HttpResponse Response
 		{
 			get {
@@ -91,6 +111,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public HttpServerUtility Server
 		{
 			get {
@@ -101,6 +123,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public HttpSessionState Session
 		{
 			get {
@@ -111,6 +135,8 @@ namespace System.Web.UI
 			}
 		}
 
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
 		public TraceContext Trace
 		{
 			get {
@@ -122,11 +148,13 @@ namespace System.Web.UI
 		}
 
 		[MonoTODO]
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		public void DesignerInitialize ()
 		{
 			throw new NotImplementedException ();
 		}
 
+		[EditorBrowsable (EditorBrowsableState.Never)]
 		public void InitializeAsUserControl (Page page)
 		{
 			if (initialized)
@@ -185,6 +213,28 @@ namespace System.Web.UI
 			EnsureAttributes ();
 			Attributes [name] = value;
 		}
+
+		string IUserControlDesignerAccessor.InnerText
+		{
+			get {
+				string innerText = ((string) ViewState["!DesignTimeInnerText"]);
+				if (innerText == null)
+					return string.Empty; 
+				return innerText;
+			}
+			set { ViewState["!DesignTimeInnerText"] = value; }
+		}
+
+		string IUserControlDesignerAccessor.TagName
+		{
+			get {
+				string innerTag = ((string) ViewState["!DesignTimeTagName"]);
+				if (innerTag == null)
+					return string.Empty; 
+				return innerTag;
+			}
+			set { ViewState["!DesignTimeTagName"] = value; }
+		}
 	}
 }