Author: mhabersack
Date: 2007-08-31 07:30:58 -0400 (Fri, 31 Aug 2007)
New Revision: 85094

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
Log:
2007-08-31  Marek Habersack  <[EMAIL PROTECTED]>

            * GridView.cs: instead of not adding hidden fields to the rows,
            mark the cells they would contain as invisible. Fixes bug #82615.


Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-08-31 11:24:22 UTC (rev 85093)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-08-31 11:30:58 UTC (rev 85094)
@@ -1,3 +1,8 @@
+2007-08-31  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * GridView.cs: instead of not adding hidden fields to the rows,
+       mark the cells they would contain as invisible. Fixes bug #82615.
+
 2007-08-30 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * Menu.cs:

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2007-08-31 11:24:22 UTC (rev 85093)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2007-08-31 11:30:58 UTC (rev 85094)
@@ -1466,8 +1466,6 @@
                        
                        for (int n=0; n<fields.Length; n++) {
                                DataControlField field = fields [n];
-                               if (!field.Visible)
-                                       continue;
                                
                                DataControlFieldCell cell;
                                if (((field is BoundField) && 
((BoundField)field).DataField == RowHeaderColumn) || accessibleHeader)
@@ -1507,10 +1505,17 @@
                
                protected virtual void ExtractRowValues (IOrderedDictionary 
fieldValues, GridViewRow row, bool includeReadOnlyFields, bool 
includePrimaryKey)
                {
+                       DataControlField field;
                        foreach (TableCell cell in row.Cells) {
                                DataControlFieldCell c = cell as 
DataControlFieldCell;
-                               if (c != null)
-                                       c.ContainingField.ExtractValuesFromCell 
(fieldValues, c, row.RowState, includeReadOnlyFields);
+                               if (c == null)
+                                       continue;
+                               
+                               field = c.ContainingField;
+                               if (field != null && !field.Visible)
+                                       continue;
+                               
+                               c.ContainingField.ExtractValuesFromCell 
(fieldValues, c, row.RowState, includeReadOnlyFields);
                        }
                        if (!includePrimaryKey && DataKeyNames != null)
                                foreach (string key in DataKeyNames)
@@ -1586,6 +1591,13 @@
                                        DataControlFieldCell fcell = cell as 
DataControlFieldCell;
                                        if (fcell != null) {
                                                DataControlField field = 
fcell.ContainingField;
+                                               if (field == null)
+                                                       continue;
+                                               if (!field.Visible) {
+                                                       cell.Visible = false;
+                                                       continue;
+                                               }
+                                               
                                                switch (row.RowType) {
                                                case DataControlRowType.Header:
                                                        if 
(field.HeaderStyleCreated && !field.HeaderStyle.IsEmpty)

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

Reply via email to