2006-09-17 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / PartialCachingControl.cs
index a42b588b51c2418a12e00a5c6c3f8fbf8dd2e974..6ffbfe861310befa6013f615d2df68cf8451d54a 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Author:
 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//   Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2003 Andreas Nahr
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.ComponentModel;
+using System.Security.Permissions;
 
-namespace System.Web.UI
-{
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class PartialCachingControl : BasePartialCachingControl
        {
+               Type type;
+               Control control;
 
-               private Type controlType;
-               private Control createdControl;
-
-               internal PartialCachingControl (Type createCachedControlType)
+               internal PartialCachingControl (Type type)
                {
-                       controlType = createCachedControlType;
+                       this.type = type;
+
                }
 
-               [MonoTODO ("Implement")]
-               internal override Control CreateControl()
+               internal override Control CreateControl ()
                {
-                       createdControl = null;
-                       throw new NotImplementedException ();
+                       control = (Control) Activator.CreateInstance (type);
+                       if (control is UserControl)
+                               ((UserControl) control).InitializeAsUserControl (Page);
+
+                       return control;
                }
 
                public Control CachedControl {
-                       get {return createdControl;
+                       get { return control; 
                }
        }
 }
+