* TemplateControl.jvm.cs: Don't assume that controls containing page-specific
authorNoam Lampert <noaml@mono-cvs.ximian.com>
Tue, 10 Jun 2008 16:20:04 +0000 (16:20 -0000)
committerNoam Lampert <noaml@mono-cvs.ximian.com>
Tue, 10 Jun 2008 16:20:04 +0000 (16:20 -0000)
callbacks (e.g. Page_LoadComplete) are necessarily Page derivatives.

svn path=/trunk/mcs/; revision=105464

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs

index feedb0a17b4b2c30e0a63fa73d7b607e11f12956..23c81532138e8961b6fcd612ab7b0e8883736aa7 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-10 Noam Lampert <noaml@mainsoft.com>
+
+       * TemplateControl.jvm.cs: Don't assume that controls containing page-specific 
+       callbacks (e.g. Page_LoadComplete) are necessarily Page derivatives.
+       
 2008-06-04  Juraj Skrispky  <js@hotfeet.ch>
 
        * PageParser.cs (ProcessMainAttributes): Take value of
index 165a761e593cf4b221ea034c00dcc6bebcd13140..ebf72131e58a9a954d452e55a5a6146dbad70693 100644 (file)
@@ -33,6 +33,7 @@ using System.Web.J2EE;
 using System.Xml;
 using vmw.common;
 using System.Web.Util;
+using System.Collections.Generic;
 
 namespace System.Web.UI {
 
@@ -239,7 +240,24 @@ namespace System.Web.UI {
                                typeof (object),
                                typeof (EventArgs) };
 
+                LifeCycleEvent[] _pageEvents = new LifeCycleEvent[] { 
+                    LifeCycleEvent.PreInit,
+                    LifeCycleEvent.PreLoad,
+                    LifeCycleEvent.LoadComplete,
+                    LifeCycleEvent.PreRenderComplete,
+                    LifeCycleEvent.SaveStateComplete,
+                    LifeCycleEvent.InitComplete
+                };
+                List<LifeCycleEvent> pageEvents = new List<LifeCycleEvent>(_pageEvents);
+
+                bool isPage = Page.GetType().IsAssignableFrom(GetType());
+
                                for (int i = 0; i < methodNames.Length; i++) {
+                    
+                    // Don't look for page-only events in non-page controls.
+                    if (!isPage && pageEvents.Contains((LifeCycleEvent)i))
+                        continue;
+
                                        string methodName = methodNames [i];
                                        MethodInfo method;
                                        bool noParams = false;