2007-08-31 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Fri, 31 Aug 2007 11:30:58 +0000 (11:30 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Fri, 31 Aug 2007 11:30:58 +0000 (11:30 -0000)
            * GridView.cs: instead of not adding hidden fields to the rows,
            mark the cells they would contain as invisible. Fixes bug #82615.

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

mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs

index 37d0afb66d71e40f63f71a89280b18a65e551f1e..bc88bb23b4ce81182c9d1aa09ba8025fa76605fa 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-31  Marek Habersack  <mhabersack@novell.com>
+
+       * 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 <igorz@mainsoft.com>
 
        * Menu.cs:
index c6c00c4432029c06e640f7bc266838735cf9576a..5ab365bfe9335b64622473b9ca7fafb8f948e09a 100644 (file)
@@ -1466,8 +1466,6 @@ namespace System.Web.UI.WebControls
                        
                        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 @@ namespace System.Web.UI.WebControls
                
                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 @@ namespace System.Web.UI.WebControls
                                        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)