2006-11-21 Igor Zelmanovich <igorz@mainsoft.com>
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 21 Nov 2006 14:31:34 +0000 (14:31 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 21 Nov 2006 14:31:34 +0000 (14:31 -0000)
* Page.cs: fixed: PreviousPage property
when CrossPostBack is processed PreviousPage is initialized
only if PreviousPage property is called.

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

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/Page.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/Test/System.Web.UI.WebControls/CrossPagePostingTest.cs

index 42b639a541ae60aa16e8e407cc3c37611b8658a8..0287f300b40563516339020c88b2f1a24a840fe5 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-21 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * Page.cs: fixed: PreviousPage property
+       when CrossPostBack is processed PreviousPage is initialized 
+       only if PreviousPage property is called.         
+
 2006-11-21 Igor Zelmanovich <igorz@mainsoft.com>
 
        * DataSourceControl.cs: fixed: Focus(), EnableTheming 
index ac965e0c7828802008c5afd92d9ee8a88f5e6a46..74f8bdc1a8861b28606500ade11f433331a46197 100644 (file)
@@ -74,6 +74,7 @@ public class Page : TemplateControl, IHttpHandler
        private PageLifeCycle _lifeCycle = PageLifeCycle.Unknown;
        private bool _eventValidation = true;
        private object [] _savedControlState;
+       private bool _doLoadPreviousPage;
 #endif
        private bool _viewState = true;
        private bool _viewStateMac;
@@ -1169,13 +1170,17 @@ public class Page : TemplateControl, IHttpHandler
                // http://msdn2.microsoft.com/en-us/library/ms178141.aspx
                if (_requestValueCollection != null) {
                        if (!isCrossPagePostBack && _requestValueCollection [PreviousPageID] != null && _requestValueCollection [PreviousPageID] != Request.FilePath) {
-                               LoadPreviousPageReference ();
+                               _doLoadPreviousPage = true;
                        }
                        else {
                                isCallback = _requestValueCollection [CallbackArgumentID] != null;
                                isPostBack = !isCallback;
                        }
                }
+               
+               // if request was transfered from other page - track Prev. Page
+               previousPage = _context.LastPage;
+               _context.LastPage = this;
 
                _lifeCycle = PageLifeCycle.PreInit;
                OnPreInit (EventArgs.Empty);
@@ -1742,7 +1747,13 @@ public class Page : TemplateControl, IHttpHandler
        [BrowsableAttribute (false)]
        [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
        public Page PreviousPage {
-               get { return previousPage; }
+               get {
+                       if (_doLoadPreviousPage) {
+                               _doLoadPreviousPage = false;
+                               LoadPreviousPageReference ();
+                       }
+                       return previousPage;
+               }
        }
 
        
@@ -1918,11 +1929,8 @@ public class Page : TemplateControl, IHttpHandler
                        if (prevPage != null) {
                                previousPage = (Page) PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage), Context);
                                previousPage.ProcessCrossPagePostBack (_context);
-                       } else {
-                               previousPage = _context.LastPage;
-                       }
+                       } 
                }
-               _context.LastPage = this;
        }
 
 
index 01fe378467cce5525010ffe6ff6dd993a23293ae..00ad916312a807f30ef805317f238fe0b6c681ac 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-21  Igor Zelmanovich   <igorz@mainsoft.com>
+
+       * CrossPagePostingTest.cs: removed NotWorking attributes.
+
 2006-11-21  Igor Zelmanovich   <igorz@mainsoft.com>
 
        * DataSourceControlTest.cs: removed NotWorking attributes.
index 03e8217de17cbac6ff8c53699af0e0b956ae7066..7ea9bf405bb5e37faf699255b3091a3fbb286ec1 100644 (file)
@@ -50,9 +50,9 @@ namespace MonoTests.System.Web.UI.WebControls
 #if DOT_NET\r
                        WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.CrossPagePosting1.aspx", "CrossPagePosting1.aspx");\r
                        WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.CrossPagePosting2.aspx", "CrossPagePosting2.aspx");\r
-#else
-                       WebTest.CopyResource (GetType (), "CrossPagePosting1.aspx", "CrossPagePosting1.aspx");
-                       WebTest.CopyResource (GetType (), "CrossPagePosting2.aspx", "CrossPagePosting2.aspx");
+#else\r
+                       WebTest.CopyResource (GetType (), "CrossPagePosting1.aspx", "CrossPagePosting1.aspx");\r
+                       WebTest.CopyResource (GetType (), "CrossPagePosting2.aspx", "CrossPagePosting2.aspx");\r
 #endif\r
                }\r
 \r
@@ -64,7 +64,6 @@ namespace MonoTests.System.Web.UI.WebControls
 \r
                [Test]\r
                [Category ("NunitWeb")]\r
-               [Category ("NotWorking")]\r
                public void CrossPagePosting_BaseFixture ()\r
                {\r
                        WebTest t = new WebTest ("CrossPagePosting1.aspx");\r
@@ -100,7 +99,6 @@ namespace MonoTests.System.Web.UI.WebControls
 \r
                [Test]\r
                [Category ("NunitWeb")]\r
-               [Category ("NotWorking")]\r
                public void CrossPagePosting_BaseFlow ()\r
                {\r
                        // NOTE!!! Test user data assigned stright on aspx pages\r