Fix the order of OnInit invocation of controls created via master page content (see...
authorAndrew Skiba <andrews@mono-cvs.ximian.com>
Thu, 25 May 2006 07:39:34 +0000 (07:39 -0000)
committerAndrew Skiba <andrews@mono-cvs.ximian.com>
Thu, 25 May 2006 07:39:34 +0000 (07:39 -0000)
svn path=/trunk/mcs/; revision=61098

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/Control.cs
mcs/class/System.Web/System.Web.UI/Page.cs

index 8641c34d2a12329b170dcf141b7c377b1690d015..73123cb621d5abdba08da3d09598ad12d7140b27 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-25  Andrew Skiba  <andrews@mainsoft.com>
+
+       * Page.cs, Control.cs: Fix the order of OnInit invocation of controls
+       created via master page content (see 
+       http://lists.ximian.com/pipermail/mono-devel-list/2006-May/018585.html ).
+
 2006-05-11  Andrew Skiba  <andrews@mainsoft.com>
 
        * Page.cs, PageTheme.cs: This patch uses LinkedStyleSheets from the
index ec31184d60bff565e9c7e95cf3830f06e47af1ed..427bf8d86ddea772b306c34ee1992beffd44cfba 100644 (file)
@@ -1253,7 +1253,6 @@ namespace System.Web.UI
                                trace.Write ("control", String.Format ("InitRecursive {0} {1}", _userId, type_name));
                        }
 #endif
-
                         if (HasControls ()) {
                                if ((stateMask & IS_NAMING_CONTAINER) != 0)
                                        namingContainer = this;
@@ -1275,6 +1274,8 @@ namespace System.Web.UI
                                }
                        }
 
+                       ApplyTheme ();
+
                        stateMask |= INITING;
 #if NET_2_0
                        if (Adapter != null)
@@ -1395,7 +1396,7 @@ namespace System.Web.UI
 #if NET_2_0
                internal ControlSkin controlSkin;
 
-                internal void ApplyThemeRecursive ()
+                internal void ApplyTheme ()
                 {
 #if MONO_TRACE
                        TraceContext trace = (Context != null && Context.Trace.IsEnabled) ? Context.Trace : null;
@@ -1405,17 +1406,10 @@ namespace System.Web.UI
                                trace.Write ("control", String.Format ("ApplyThemeRecursive {0} {1}", _userId, type_name));
                        }
 #endif
-                       ControlSkin controlSkin = Page.PageTheme.GetControlSkin (GetType(), SkinID);
-                       if (controlSkin != null)
-                               controlSkin.ApplySkin (this);
-
-                        if (HasControls ()) {
-                               int len = _controls.Count;
-                               for (int i=0;i<len;i++)
-                               {
-                                       Control c = _controls[i];
-                                       c.ApplyThemeRecursive ();
-                               }
+                       if (Page.PageTheme != null) {
+                               ControlSkin controlSkin = Page.PageTheme.GetControlSkin (GetType (), SkinID);
+                               if (controlSkin != null)
+                                       controlSkin.ApplySkin (this);
                        }
 
 #if MONO_TRACE
index 6a467f442131316610b99345a79bc99ed2b5ad95..248b8174e9c7ca0b2360595ae1b8881190b35b06 100644 (file)
@@ -491,7 +491,6 @@ public class Page : TemplateControl, IHttpHandler
                }
                if (_theme != null && _theme != "") {
                        _pageTheme = ThemeDirectoryCompiler.GetCompiledInstance ("./App_Themes/" + _theme + "/", _context);
-                       ApplyThemeRecursive ();
                }
        }
 
@@ -1033,6 +1032,7 @@ public class Page : TemplateControl, IHttpHandler
                OnPreInit (EventArgs.Empty);
 
                InitializeTheme ();
+               ApplyMasterPage ();
 #endif
                Trace.Write ("aspx.page", "Begin Init");
                InitRecursive (null);
@@ -1041,7 +1041,6 @@ public class Page : TemplateControl, IHttpHandler
 #if NET_2_0
                OnInitComplete (EventArgs.Empty);
                
-               ApplyMasterPage ();
 
                if (_title != null && htmlHeader != null)
                        htmlHeader.Title = _title;