Author: krasnov
Date: 2006-07-16 11:44:22 -0400 (Sun, 16 Jul 2006)
New Revision: 62660

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs
Log:
* CommandField.cs: fixed InitializeCell, wrong order of command buttons
* ImageField.cs: image field with null src and ConvertEmptyStringToNull should 
be rendered as label
* BoundField.cs: empty null value should be rendered as nbsp
* GridViewRowCollection.cs: fixed SyncRoot


Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs  
2006-07-16 14:19:21 UTC (rev 62659)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs  
2006-07-16 15:44:22 UTC (rev 62660)
@@ -185,8 +185,14 @@
                protected virtual string FormatDataValue (object value, bool 
encode)
                {
                        string res;
-                       if (value == null || (value.ToString().Length == 0 && 
ConvertEmptyStringToNull))
-                               res = NullDisplayText;
+                       if (value == null || (value.ToString ().Length == 0 && 
ConvertEmptyStringToNull)) {
+                               if (NullDisplayText.Length == 0) {
+                                       encode = false;
+                                       res = " ";
+                               }
+                               else
+                                       res = NullDisplayText;
+                       }
                        else if (DataFormatString.Length > 0)
                                res = string.Format (DataFormatString, value);
                        else

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-07-16 14:19:21 UTC (rev 62659)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-07-16 15:44:22 UTC (rev 62660)
@@ -1,3 +1,12 @@
+2006-07-16 Vladimir Krasnov <[EMAIL PROTECTED]>
+
+       * CommandField.cs: fixed InitializeCell, wrong order of command 
+       buttons
+       * ImageField.cs: image field with null src and ConvertEmptyStringToNull
+       should be rendered as label
+       * BoundField.cs: empty null value should be rendered as nbsp
+       * GridViewRowCollection.cs: fixed SyncRoot
+
 2006-07-16 Andrew Skiba <[EMAIL PROTECTED]>
 
        * SiteMapPath.cs: create Literal instead of Label according to the

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs        
2006-07-16 14:19:21 UTC (rev 62659)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs        
2006-07-16 15:44:22 UTC (rev 62660)
@@ -301,14 +301,14 @@
                                                AddSeparator (cell);
                                                cell.Controls.Add (CreateButton 
(DeleteText, DeleteImageUrl, DataControlCommands.DeleteCommandName, index));
                                        }
+                                       if (ShowInsertButton) {
+                                               AddSeparator (cell);
+                                               cell.Controls.Add (CreateButton 
(NewText, NewImageUrl, DataControlCommands.NewCommandName, index));
+                                       }
                                        if (ShowSelectButton) {
                                                AddSeparator (cell);
                                                cell.Controls.Add (CreateButton 
(SelectText, SelectImageUrl, DataControlCommands.SelectCommandName, index));
                                        }
-                                       if (ShowInsertButton) {
-                                               AddSeparator (cell);
-                                               cell.Controls.Add (CreateButton 
(NewText, NewImageUrl, DataControlCommands.NewCommandName, index));
-                                       }
                                }
                        } else
                                base.InitializeCell (cell, cellType, rowState, 
rowIndex);

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs   
    2006-07-16 14:19:21 UTC (rev 62659)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs   
    2006-07-16 15:44:22 UTC (rev 62660)
@@ -68,7 +68,7 @@
                }
                
                public object SyncRoot {
-                       get { return rows.SyncRoot; }
+                       get { return this; }
                }
                
                void System.Collections.ICollection.CopyTo (Array array, int 
index)

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs  
2006-07-16 14:19:21 UTC (rev 62659)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs  
2006-07-16 15:44:22 UTC (rev 62660)
@@ -197,14 +197,14 @@
                {
                        if ((ReadOnly && !includeReadOnly) || 
cell.Controls.Count == 0) return;
                        
-                       bool editable = (rowState & (DataControlRowState.Edit | 
DataControlRowState.Insert)) != 0;
+                       bool editable = (rowState & (DataControlRowState.Edit | 
DataControlRowState.Insert)) != 0;
                        if (includeReadOnly || editable) {
-                               Control control = cell.Controls [0];
+                               Control control = cell.Controls [0];
                                //TODO: other controls?
                                if (control is Image)
                                        dictionary [DataImageUrlField] = 
((Image)control).ImageUrl;
                                else
-                               if (control is TextBox)
+                               if (control is TextBox)
                                        dictionary [DataImageUrlField] = 
((TextBox) control).Text;
                        }
                }
@@ -225,13 +225,13 @@
                        bool editable = (rowState & (DataControlRowState.Edit | 
DataControlRowState.Insert)) != 0;
                        if (editable && !ReadOnly) {
                                TextBox box = new TextBox ();
-                               cell.Controls.Add (box);
-                       }
-                       else if (DataImageUrlField.Length > 0) {
-                               Image img = new Image ();
-                               img.ControlStyle.CopyFrom (ControlStyle);
-                               cell.Controls.Add (img);
+                               cell.Controls.Add (box);
                        }
+                       else if (DataImageUrlField.Length > 0) {
+                               Image img = new Image ();
+                               img.ControlStyle.CopyFrom (ControlStyle);
+                               cell.Controls.Add (img);
+                       }
                }
                
                protected virtual string FormatImageUrlValue (object value)
@@ -269,11 +269,11 @@
                {
                        if (DesignMode)
                                return GetDesignTimeValue ();
-                       else {
-                               object dataItem = DataBinder.GetDataItem 
(controlContainer);
-                               if (dataItem == null)
+                       else {
+                               object dataItem = DataBinder.GetDataItem 
(controlContainer);
+                               if (dataItem == null)
                                        throw new HttpException ("A data item 
was not found in the container. The container must either implement 
IDataItemContainer, or have a property named DataItem.");
-                               if (fieldName == ThisExpression)
+                               if (fieldName == ThisExpression)
                                        return dataItem.ToString ();
                                else {
                                        if (cachedDescriptor != null) return 
cachedDescriptor.GetValue (dataItem);
@@ -311,9 +311,17 @@
                        }
                        else if (c is Image) {
                                Image img = (Image)c;
-                               string value =  FormatImageUrlValue (GetValue 
(cell.BindingContainer, DataImageUrlField, ref imageProperty));
-                               if (value == null || (ConvertEmptyStringToNull 
&& value.ToString ().Length == 0))
-                                       value = NullImageUrl;
+                               string value =  FormatImageUrlValue (GetValue 
(cell.BindingContainer, DataImageUrlField, ref imageProperty));
+                               if (value == null || (ConvertEmptyStringToNull 
&& value.ToString ().Length == 0)) {
+                                       if (NullImageUrl == null || 
NullImageUrl.Length == 0) {
+                                               c.Visible = false;
+                                               Label label = new Label ();
+                                               label.Text = NullDisplayText;
+                                               cell.Controls.Add (label);
+                                       }
+                                       else
+                                               value = NullImageUrl;
+                               }
                                img.ImageUrl = value;
                                img.AlternateText = GetFormattedAlternateText 
(cell.BindingContainer);
                        }

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

Reply via email to