Author: igorz
Date: 2007-01-04 08:23:08 -0500 (Thu, 04 Jan 2007)
New Revision: 70473

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
Log:
2007-01-04 Igor Zelmanovich <[EMAIL PROTECTED]>

        * FormView.cs: fixed data binding flow considers Insert mode.    



Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-01-04 13:00:44 UTC (rev 70472)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-01-04 13:23:08 UTC (rev 70473)
@@ -1,5 +1,9 @@
-2006-01-04 Igor Zelmanovich <[EMAIL PROTECTED]>
+2007-01-04 Igor Zelmanovich <[EMAIL PROTECTED]>
 
+       * FormView.cs: fixed data binding flow considers Insert mode.    
+
+2007-01-04 Igor Zelmanovich <[EMAIL PROTECTED]>
+
        * DataBoundControl.cs: fixed Init flow.  
 
 2007-01-4   Adar Wesley <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs    
2007-01-04 13:00:44 UTC (rev 70472)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs    
2007-01-04 13:23:08 UTC (rev 70473)
@@ -791,7 +791,6 @@
                [BrowsableAttribute (false)]
                public virtual object DataItem {
                        get {
-                               EnsureDataBound ();
                                return dataItem;
                        }
                }
@@ -859,7 +858,17 @@
 
                protected override void EnsureDataBound ()
                {
-                       base.EnsureDataBound ();
+                       if (CurrentMode == FormViewMode.Insert) {
+                               if (RequiresDataBinding) {
+                                       RequiresDataBinding = false;
+                                       OnDataBinding (EventArgs.Empty);
+                                       PerformDataBinding (new object [] { 
null });
+                                       MarkAsDataBound ();
+                                       OnDataBound (EventArgs.Empty);
+                               }
+                       }
+                       else
+                               base.EnsureDataBound ();
                }
        
                protected override Style CreateControlStyle ()
@@ -1085,12 +1094,6 @@
                
                public sealed override void DataBind ()
                {
-                       if (CurrentMode == FormViewMode.Insert) {
-                               RequiresDataBinding = false;
-                               PerformDataBinding (new object [] { null });
-                               return;
-                       }
-
                        cachedKeyProperties = null;
                        base.DataBind ();
                        
@@ -1268,6 +1271,8 @@
                
                public void ChangeMode (FormViewMode newMode)
                {
+                       if (CurrentMode == newMode)
+                               return;
                        CurrentMode = newMode;
                        RequireBinding ();
                }

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

Reply via email to