Author: igorz
Date: 2006-09-25 07:26:45 -0400 (Mon, 25 Sep 2006)
New Revision: 65879

Modified:
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/Page.cs
Log:
* Page.cs: fixed: Cross-page postback feature in ASP.NET 2.0
When page is invoked by cross-page posting, PreviousPage processed all 
live-cycle up to OnLoadComplite included.
IsPostBack, IsCallBack and IsCrossPagePostBack returns relevant values.


Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-09-25 09:40:16 UTC 
(rev 65878)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-09-25 11:26:45 UTC 
(rev 65879)
@@ -1,3 +1,10 @@
+2006-09-25 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+       * Page.cs: fixed: Cross-page postback feature in ASP.NET 2.0
+       When page is invoked by cross-page posting, PreviousPage processed all 
+       live-cycle up to OnLoadComplite included.
+       IsPostBack, IsCallBack and IsCrossPagePostBack returns relevant values.
+
 2006-09-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * TemplateParser.cs: patch by Joel Reed that makes use of the namespace

Modified: trunk/mcs/class/System.Web/System.Web.UI/Page.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/Page.cs    2006-09-25 09:40:16 UTC 
(rev 65878)
+++ trunk/mcs/class/System.Web/System.Web.UI/Page.cs    2006-09-25 11:26:45 UTC 
(rev 65879)
@@ -130,6 +130,8 @@
        
        Page previousPage;
        bool isCrossPagePostBack;
+       bool isPostBack;
+       bool isCallback;
        ArrayList requireStateControls;
        Hashtable _validatorsByGroup;
        HtmlForm _form;
@@ -346,7 +348,11 @@
        public bool IsPostBack
        {
                get {
+#if NET_2_0
+                       return isPostBack;
+#else
                        return _requestValueCollection != null;
+#endif
                }
        }
 
@@ -1114,9 +1120,17 @@
                _requestValueCollection = this.DeterminePostBackMode();
 
 #if NET_2_0
-               if (!IsCrossPagePostBack)
-                       LoadPreviousPageReference ();
-                       
+               // http://msdn2.microsoft.com/en-us/library/ms178141.aspx
+               if (_requestValueCollection != null) {
+                       if (!isCrossPagePostBack && _requestValueCollection 
[PreviousPageID] != null && _requestValueCollection [PreviousPageID] != 
Request.FilePath) {
+                               LoadPreviousPageReference ();
+                       }
+                       else {
+                               isCallback = _requestValueCollection 
[CallbackArgumentID] != null;
+                               isPostBack = !isCallback;
+                       }
+               }
+
                OnPreInit (EventArgs.Empty);
 
                InitializeTheme ();
@@ -1141,9 +1155,6 @@
                }
 
 #if NET_2_0
-               if (IsCrossPagePostBack)
-                       return;
-
                OnPreLoad (EventArgs.Empty);
 #endif
 
@@ -1163,6 +1174,9 @@
 #if NET_2_0
                OnLoadComplete (EventArgs.Empty);
 
+               if (IsCrossPagePostBack)
+                       return;
+
                if (IsCallback) {
                        string result = ProcessCallbackData ();
                        HtmlTextWriter callbackOutput = new HtmlTextWriter 
(_context.Response.Output);
@@ -1638,13 +1652,13 @@
        [DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]
        [BrowsableAttribute (false)]
        public bool IsCallback {
-               get { return _requestValueCollection != null && 
_requestValueCollection [CallbackArgumentID] != null; }
+               get { return isCallback; }
        }
        
        [BrowsableAttribute (false)]
        [DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]
        public bool IsCrossPagePostBack {
-               get { return _requestValueCollection != null && 
isCrossPagePostBack; }
+               get { return isCrossPagePostBack; }
        }
        
        string ProcessCallbackData ()

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to