Author: lluis
Date: 2005-03-23 12:20:57 -0500 (Wed, 23 Mar 2005)
New Revision: 42154

Added:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs
   
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
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/DataControlField.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
Log:
2005-03-23  Lluis Sanchez Gual <[EMAIL PROTECTED]>

        * DataControlField.cs: Added missing InsertVisible property.
        * AutoGeneratedFieldProperties.cs: Implemented.
        * PagerSettings.cs: Minor fix.
        * GridView.cs: Implemented support for autogenerated fields, templates,
        accessible headers. Implemented paging using PagedDataSource.
        Implemented missing overridable methods.
        * AutoGeneratedField.cs: Initial implementation.
        * BoundField.cs: Added ReadOnly property.
        * PagedDataSource.cs: Implemented 2.0 api.
        * DataControlFieldCell.cs: Implemented AccessibleDataControlFieldCell
        cell class to be used by accessible headers.
        * TableCell.cs: Removed unneded constructor. If the cell is bound to
        a template, call the default RenderContents method.



Added: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs  
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs  
2005-03-23 17:20:57 UTC (rev 42154)
@@ -0,0 +1,130 @@
+//
+// System.Web.UI.WebControls.AutoGeneratedField.cs
+//
+// Authors:
+//     Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+       [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+       [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = 
AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, 
Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class AutoGeneratedField : BoundField
+       {
+               Type dataType;
+               
+               public AutoGeneratedField (string dataField)
+               {
+                       DataField = dataField;
+               }
+               
+               internal AutoGeneratedField (AutoGeneratedFieldProperties 
fieldProperties)
+               {
+                       DataField = fieldProperties.DataField;
+                       DataType = fieldProperties.Type;
+                       HeaderText = fieldProperties.Name;
+                       ReadOnly = fieldProperties.IsReadOnly;
+               }
+               
+               [MonoTODO]
+               public Type DataType {
+                       get { return dataType; }
+                       set { dataType = value; }
+               }
+               
+               public override bool ConvertEmptyStringToNull {
+                       get { return true; }
+                       set { throw new NotSupportedException (); }
+               }
+
+               public override string DataFormatString {
+                       get { return string.Empty; }
+                       set { throw new NotSupportedException (); }
+               }
+
+               public override bool InsertVisible {
+                       get { return true; }
+                       set { throw new NotSupportedException (); }
+               }
+               
+               [MonoTODO ("Support other data types")]
+               public override void ExtractValuesFromCell (IOrderedDictionary 
dictionary,
+                       DataControlFieldCell cell, DataControlRowState 
rowState, bool includeReadOnly)
+               {
+                       if (dataType == typeof(bool)) {
+                               CheckBox box = (CheckBox) cell.Controls [0];
+                               dictionary [DataField] = box.Checked;
+                       } else
+                               base.ExtractValuesFromCell (dictionary, cell, 
rowState, includeReadOnly);
+               }
+               
+               
+               [MonoTODO ("Support other data types")]
+               public override void InitializeDataCell (DataControlFieldCell 
cell, DataControlRowState rowState)
+               {
+                       bool editable = (rowState & DataControlRowState.Edit) 
!= 0;
+                       
+                       if (dataType == typeof(bool)) {
+                               CheckBox box = new CheckBox ();
+                               box.Enabled = editable && !ReadOnly;
+                               cell.Controls.Add (box);
+                       } else
+                               base.InitializeDataCell (cell, rowState);
+               }
+               
+               [MonoTODO ("Support other data types")]
+               protected override void OnDataBindField (object sender, 
EventArgs e)
+               {
+                       DataControlFieldCell cell = (DataControlFieldCell) 
sender;
+                       if (dataType == typeof(bool)) {
+                               CheckBox box = (CheckBox) cell.Controls [0];
+                               object val = GetValue (cell.BindingContainer);
+                               if (val != null) {
+                                       box.Checked = (bool)val;
+                                       if (!box.Visible)
+                                               box.Visible = true;
+                               }
+                               else
+                                       box.Visible = false;
+                       } else
+                               base.OnDataBindField (sender, e);
+               }
+               
+               public override void ValidateSupportsCallback ()
+               {
+               }
+               
+       }
+}
+#endif

Added: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
        2005-03-23 17:07:26 UTC (rev 42153)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
        2005-03-23 17:20:57 UTC (rev 42154)
@@ -0,0 +1,106 @@
+//
+// System.Web.UI.WebControls.AutoGeneratedFieldProperties.cs
+//
+// Authors:
+//     Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System.Web.UI;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+       [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = 
AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, 
Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class AutoGeneratedFieldProperties: IStateManager
+       {
+               StateBag ViewState = new StateBag ();
+
+               public string DataField {
+                       get {
+                               object ob = ViewState ["DataField"];
+                               if (ob != null) return (string) ob;
+                               return string.Empty;
+                       }
+                       set {
+                               ViewState ["DataField"] = value;
+                       }
+               }
+               
+               public bool IsReadOnly {
+                       get {
+                               object val = ViewState ["IsReadOnly"];
+                               return val != null ? (bool) val : false;
+                       }
+                       set { 
+                               ViewState ["IsReadOnly"] = value;
+                       }
+               }
+               
+               public string Name {
+                       get {
+                               object ob = ViewState ["Name"];
+                               if (ob != null) return (string) ob;
+                               return string.Empty;
+                       }
+                       set {
+                               ViewState ["Name"] = value;
+                       }
+               }
+               
+               public Type Type {
+                       get {
+                               object ob = ViewState ["Type"];
+                               if (ob != null) return (Type) ob;
+                               return null;
+                       }
+                       set {
+                               ViewState ["Type"] = value;
+                       }
+               }
+               
+               void IStateManager.LoadViewState (object state)
+               {
+                       ViewState.LoadViewState (state);
+               }
+
+               object IStateManager.SaveViewState ()
+               {
+                       return ViewState.SaveViewState ();
+               }
+
+               void IStateManager.TrackViewState ()
+               {
+                       ViewState.TrackViewState ();
+               }
+
+               bool IStateManager.IsTrackingViewState {
+                       get { return ViewState.IsTrackingViewState; }
+               }
+       }
+}
+#endif

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs  
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs  
2005-03-23 17:20:57 UTC (rev 42154)
@@ -34,6 +34,7 @@
 using System.Web.UI;
 using System.ComponentModel;
 using System.Security.Permissions;
+using System.Reflection;
 
 namespace System.Web.UI.WebControls {
 
@@ -102,10 +103,22 @@
                        }
                }
 
+               [WebCategoryAttribute ("Behavior")]
+               [DefaultValueAttribute (false)]
+               public bool ReadOnly {
+                       get {
+                               object val = ViewState ["ReadOnly"];
+                               return val != null ? (bool) val : false;
+                       }
+                       set { 
+                               ViewState ["ReadOnly"] = value;
+                       }
+               }
+               
                public override void ExtractValuesFromCell (IOrderedDictionary 
dictionary,
                        DataControlFieldCell cell, DataControlRowState 
rowState, bool includeReadOnly)
                {
-                       if ((rowState & DataControlRowState.Edit) != 0) {
+                       if ((rowState & DataControlRowState.Edit) != 0 && 
!ReadOnly) {
                                if (cell.Controls.Count > 0) {
                                        TextBox box = cell.Controls [0] as 
TextBox;
                                        dictionary [DataField] = box.Text;
@@ -126,7 +139,7 @@
                
                public virtual void InitializeDataCell (DataControlFieldCell 
cell, DataControlRowState rowState)
                {
-                       if ((rowState & DataControlRowState.Edit) != 0) {
+                       if ((rowState & DataControlRowState.Edit) != 0 && 
!ReadOnly) {
                                TextBox box = new TextBox ();
                                cell.Controls.Add (box);
                        }
@@ -167,6 +180,10 @@
                                                boundProperty = 
desc.GetProperties () [DataField];
                                                if (boundProperty != null)
                                                        return 
boundProperty.GetValue (dic.DataItem);
+                                       } else {
+                                               PropertyInfo pi = 
dic.DataItem.GetType ().GetProperty (DataField);
+                                               if (pi != null)
+                                                       return pi.GetValue 
(dic.DataItem, null);
                                        }
                                        throw new InvalidOperationException 
("Property '" + DataField + "' not found in data bound item");
                                }

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2005-03-23 17:20:57 UTC (rev 42154)
@@ -1,3 +1,19 @@
+2005-03-23  Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+       * DataControlField.cs: Added missing InsertVisible property.
+       * AutoGeneratedFieldProperties.cs: Implemented.
+       * PagerSettings.cs: Minor fix.
+       * GridView.cs: Implemented support for autogenerated fields, templates,
+       accessible headers. Implemented paging using PagedDataSource.
+       Implemented missing overridable methods.
+       * AutoGeneratedField.cs: Initial implementation.
+       * BoundField.cs: Added ReadOnly property.
+       * PagedDataSource.cs: Implemented 2.0 api.
+       * DataControlFieldCell.cs: Implemented AccessibleDataControlFieldCell
+       cell class to be used by accessible headers.
+       * TableCell.cs: Removed unneded constructor. If the cell is bound to
+       a template, call the default RenderContents method.
+
 2005-03-16  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * TreeNode.cs, TreeView.cs: Don't raise the SelectedNodeChanged

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs    
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs    
2005-03-23 17:20:57 UTC (rev 42154)
@@ -281,6 +281,19 @@
                        }
                }
 
+               [WebCategoryAttribute ("Behavior")]
+               [DefaultValueAttribute (true)]
+               public virtual bool InsertVisible {
+                       get {
+                               object val = viewState ["InsertVisible"];
+                               return val != null ? (bool) val : true;
+                       }
+                       set { 
+                               viewState ["InsertVisible"] = value;
+                               OnFieldChanged ();
+                       }
+               }
+
                [DesignerSerializationVisibility 
(DesignerSerializationVisibility.Content)]
                [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
                [WebCategoryAttribute ("Styles")]

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs    
    2005-03-23 17:07:26 UTC (rev 42153)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs    
    2005-03-23 17:20:57 UTC (rev 42154)
@@ -3,6 +3,7 @@
 //
 // Authors:
 //     Sanjay Gupta ([EMAIL PROTECTED])
+//  Lluis Sanchez Gual ([EMAIL PROTECTED])
 //
 // (C) 2004 Novell, Inc. (http://www.novell.com)
 //
@@ -31,7 +32,8 @@
 #if NET_2_0
 using System.Web.UI;
 
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
        public class DataControlFieldCell : TableCell
        {
                DataControlField containerField;
@@ -49,5 +51,25 @@
                        get { return containerField; }
                }
        }
+
+       internal class AccessibleDataControlFieldCell : DataControlFieldCell
+       {
+               bool colScope;
+               
+               public AccessibleDataControlFieldCell (bool colScope, 
DataControlField containerField): base (HtmlTextWriterTag.Th, containerField)
+               {
+                       this.colScope = colScope;
+               }
+               
+               protected override void AddAttributesToRender (HtmlTextWriter 
writer)
+               {
+                       base.AddAttributesToRender (writer);
+                       if (colScope)
+                               writer.AddAttribute 
(HtmlTextWriterAttribute.Scope, "col");
+                       else
+                               writer.AddAttribute 
(HtmlTextWriterAttribute.Scope, "row");
+               }
+       }
 }
+       
 #endif

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2005-03-23 17:20:57 UTC (rev 42154)
@@ -36,6 +36,7 @@
 using System.Security.Permissions;
 using System.Text;
 using System.IO;
+using System.Reflection;
 
 namespace System.Web.UI.WebControls
 {
@@ -57,9 +58,8 @@
                IOrderedDictionary currentEditNewValues;
                IOrderedDictionary currentEditOldValues;
                
-               CommandField commandField;
-               
                ITemplate pagerTemplate;
+               ITemplate emptyDataTemplate;
                        
                // View state
                DataControlFieldCollection columns;
@@ -75,6 +75,7 @@
                TableItemStyle selectedRowStyle;
                DataKeyArray keys;
                DataKey oldEditValues;
+               AutoGeneratedFieldProperties[] autoFieldProperties;
                
                private static readonly object PageIndexChangedEvent = new 
object();
                private static readonly object PageIndexChangingEvent = new 
object();
@@ -310,6 +311,7 @@
                        }
                        set {
                                ViewState ["AllowPaging"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -323,6 +325,7 @@
                        }
                        set {
                                ViewState ["AllowSorting"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -351,6 +354,7 @@
                        }
                        set {
                                ViewState ["AutoGenerateEditButton"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -364,6 +368,7 @@
                        }
                        set {
                                ViewState ["AutoGenerateDeleteButton"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -377,9 +382,24 @@
                        }
                        set {
                                ViewState ["AutoGenerateSelectButton"] = value;
+                               RequireBinding ();
                        }
                }
 
+               [WebCategoryAttribute ("Behavior")]
+               [DefaultValueAttribute (true)]
+               public virtual bool AutoGenerateColumns {
+                       get {
+                               object ob = ViewState ["AutoGenerateColumns"];
+                               if (ob != null) return (bool) ob;
+                               return true;
+                       }
+                       set {
+                               ViewState ["AutoGenerateColumns"] = value;
+                               RequireBinding ();
+                       }
+               }
+               
                [UrlPropertyAttribute]
                [WebCategoryAttribute ("Appearance")]
                [DefaultValueAttribute ("")]
@@ -392,6 +412,7 @@
                        }
                        set {
                                ViewState ["BackImageUrl"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -415,6 +436,7 @@
                        }
                        set {
                                ViewState ["Caption"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -429,6 +451,7 @@
                        }
                        set {
                                ViewState ["CaptionAlign"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -443,6 +466,7 @@
                        }
                        set {
                                ViewState ["CellPadding"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -457,6 +481,7 @@
                        }
                        set {
                                ViewState ["CellSpacing"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -490,6 +515,7 @@
                        }
                        set {
                                ViewState ["DataKeyNames"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -544,6 +570,30 @@
                        }
                }
                
+               [DefaultValue (null)]
+               [TemplateContainer (typeof(GridView), BindingDirection.OneWay)]
+               [PersistenceMode (PersistenceMode.InnerProperty)]
+           [Browsable (false)]
+               public ITemplate EmptyDataTemplate {
+                       get { return emptyDataTemplate; }
+                       set { emptyDataTemplate = value; RequireBinding (); }
+               }
+               
+               [LocalizableAttribute (true)]
+               [WebCategoryAttribute ("Appearance")]
+               [DefaultValueAttribute ("")]
+               public virtual string EmptyDataText {
+                       get {
+                               object ob = ViewState ["EmptyDataText"];
+                               if (ob != null) return (string) ob;
+                               return string.Empty;
+                       }
+                       set {
+                               ViewState ["EmptyDataText"] = value;
+                               RequireBinding ();
+                       }
+               }
+       
                [WebCategoryAttribute ("Behavior")]
                [DefaultValueAttribute (false)]
                public virtual bool EnableSortingAndPagingCallbacks {
@@ -632,6 +682,7 @@
                        }
                        set {
                                ViewState ["HorizontalAlign"] = value;
+                               RequireBinding ();
                        }
                }
 
@@ -641,8 +692,6 @@
                        get {
                                if (pageCount != -1) return pageCount;
                                EnsureDataBound ();
-                               if (SelectArguments.TotalRowCount == 0) 
pageCount = 1;
-                               else pageCount = 
((SelectArguments.TotalRowCount - 1) / PageSize) + 1;
                                return pageCount;
                        }
                }
@@ -670,6 +719,7 @@
                        }
                        set {
                                ViewState ["PageSize"] = value;
+                               RequireBinding ();
                        }
                }
        
@@ -713,6 +763,21 @@
                        set { pagerTemplate = value; RequireBinding (); }
                }
                
+               [DefaultValueAttribute ("")]
+               [WebCategoryAttribute ("Accessibility")]
+//             [TypeConverterAttribute 
(typeof(System.Web.UI.Design.DataColumnSelectionConverter)]
+               public virtual string RowHeaderColumn {
+                       get {
+                               object ob = ViewState ["RowHeaderColumn"];
+                               if (ob != null) return (string) ob;
+                               return string.Empty;
+                       }
+                       set {
+                               ViewState ["RowHeaderColumn"] = value;
+                               RequireBinding ();
+                       }
+               }
+               
                [DesignerSerializationVisibilityAttribute 
(DesignerSerializationVisibility.Hidden)]
                [BrowsableAttribute (false)]
                public virtual GridViewRowCollection Rows {
@@ -808,6 +873,7 @@
                        }
                        set {
                                ViewState ["ShowFooter"] = value;
+                               RequireBinding ();
                        }
                }
        
@@ -821,6 +887,7 @@
                        }
                        set {
                                ViewState ["ShowHeader"] = value;
+                               RequireBinding ();
                        }
                }
                
@@ -847,9 +914,23 @@
                        }
                }
        
+               [WebCategoryAttribute ("Accessibility")]
+               [DefaultValueAttribute (true)]
+               public virtual bool UseAccessibleHeader {
+                       get {
+                               object ob = ViewState ["UseAccessibleHeader"];
+                               if (ob != null) return (bool) ob;
+                               return true;
+                       }
+                       set {
+                               ViewState ["UseAccessibleHeader"] = value;
+                               RequireBinding ();
+                       }
+               }
+       
                public virtual bool IsBindableType (Type type)
                {
-                       return type.IsPrimitive || type == typeof(DateTime) || 
type == typeof(Guid);
+                       return type.IsPrimitive || type == typeof(string) || 
type == typeof(DateTime) || type == typeof(Guid);
                }
                
                protected override DataSourceSelectArguments 
CreateDataSourceSelectArguments ()
@@ -857,6 +938,105 @@
                        return base.CreateDataSourceSelectArguments ();
                }
                
+               protected virtual ICollection CreateColumns (PagedDataSource 
dataSource, bool useDataSource)
+               {
+                       ArrayList fields = new ArrayList ();
+                       
+                       if (AutoGenerateEditButton || AutoGenerateDeleteButton 
|| AutoGenerateSelectButton) {
+                               CommandField field = new CommandField ();
+                               field.ShowEditButton = AutoGenerateEditButton;
+                               field.ShowDeleteButton = 
AutoGenerateDeleteButton;
+                               field.ShowSelectButton = 
AutoGenerateSelectButton;
+                               fields.Add (field);
+                       }
+                       
+                       if (AutoGenerateColumns) {
+                               if (useDataSource)
+                                       autoFieldProperties = 
CreateAutoFieldProperties (dataSource);
+       
+                               if (autoFieldProperties != null) {
+                                       foreach (AutoGeneratedFieldProperties 
props in autoFieldProperties)
+                                               fields.Add 
(CreateAutoGeneratedColumn (props));
+                               }
+                       }
+                       
+                       fields.AddRange (Columns);
+                       
+                       return fields;
+               }
+               
+               protected virtual AutoGeneratedField CreateAutoGeneratedColumn 
(AutoGeneratedFieldProperties fieldProperties)
+               {
+                       return new AutoGeneratedField (fieldProperties);
+               }
+               
+               AutoGeneratedFieldProperties[] CreateAutoFieldProperties 
(PagedDataSource source)
+               {
+                       if(source == null) return null;
+                       
+                       PropertyDescriptorCollection props = 
source.GetItemProperties (new PropertyDescriptor[0]);
+                       Type prop_type;
+                       
+                       ArrayList retVal = new ArrayList();
+                       
+                       if (props == null)
+                       {
+                               object fitem = null;
+                               prop_type = null;
+                               PropertyInfo prop_item =  
source.DataSource.GetType().GetProperty("Item",
+                                                 BindingFlags.Instance | 
BindingFlags.Static |
+                                                 BindingFlags.Public, null, 
null,
+                                                 new Type[] { typeof(int) }, 
null);
+                               
+                               if (prop_item != null) {
+                                       prop_type = prop_item.PropertyType;
+                               }
+                               
+                               if (prop_type == null || prop_type == 
typeof(object)) {
+                                       IEnumerator en = source.GetEnumerator();
+                                       if (en.MoveNext())
+                                               fitem = en.Current;
+                                       if (fitem != null)
+                                               prop_type = fitem.GetType();
+                               }
+                               
+                               if (fitem != null && fitem is 
ICustomTypeDescriptor) {
+                                       props = 
TypeDescriptor.GetProperties(fitem);
+                               } else if (prop_type != null) {
+                                       if (IsBindableType (prop_type)) {
+                                               AutoGeneratedFieldProperties 
field = new AutoGeneratedFieldProperties ();
+                                               
((IStateManager)field).TrackViewState();
+                                               field.Name = "Item";
+                                               field.DataField = 
BoundField.ThisExpression;
+                                               field.Type = prop_type;
+                                               retVal.Add (field);
+                                       } else {
+                                               props = 
TypeDescriptor.GetProperties (prop_type);
+                                       }
+                               }
+                       }
+                       
+                       if (props != null && props.Count > 0)
+                       {
+                               foreach (PropertyDescriptor current in props) {
+                                       if (IsBindableType 
(current.PropertyType)) {
+                                               AutoGeneratedFieldProperties 
field = new AutoGeneratedFieldProperties ();
+                                               
((IStateManager)field).TrackViewState();
+                                               field.Name = current.Name;
+                                               field.DataField = current.Name;
+                                               field.IsReadOnly = 
current.IsReadOnly;
+                                               field.Type = 
current.PropertyType;
+                                               retVal.Add (field);
+                                       }
+                               }
+                       }
+
+                       if (retVal.Count > 0)
+                               return (AutoGeneratedFieldProperties[]) 
retVal.ToArray (typeof(AutoGeneratedFieldProperties));
+                       
+                       throw new 
HttpException(HttpRuntime.FormatResourceString("DataGrid_NoAutoGenColumns", 
ID));
+               }
+               
                protected virtual GridViewRow CreateRow (int rowIndex, int 
dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState)
                {
                        GridViewRow row = new GridViewRow (rowIndex, 
dataSourceIndex, rowType, rowState);
@@ -866,8 +1046,10 @@
                
                void RequireBinding ()
                {
-                       RequiresDataBinding = true;
-                       pageCount = -1;
+                       if (Initialized) {
+                               RequiresDataBinding = true;
+                               pageCount = -1;
+                       }
                }
                
                protected virtual ChildTable CreateChildTable ()
@@ -882,8 +1064,45 @@
                        return table;
                }
        
-               protected override int CreateChildControls (IEnumerable 
dataSource, bool dataBinding)
+               protected override int CreateChildControls (IEnumerable data, 
bool dataBinding)
                {
+                       PagedDataSource dataSource;
+
+                       if (dataBinding) {
+                               DataSourceView view = GetData ();
+                               dataSource = new PagedDataSource ();
+                               dataSource.DataSource = data;
+                               
+                               if (AllowPaging) {
+                                       dataSource.AllowPaging = true;
+                                       dataSource.PageSize = PageSize;
+                                       dataSource.CurrentPageIndex = PageIndex;
+                                       if (view.CanPage) {
+                                               dataSource.AllowServerPaging = 
true;
+                                               if 
(view.CanRetrieveTotalRowCount)
+                                                       dataSource.VirtualCount 
= SelectArguments.TotalRowCount;
+                                               else {
+                                                       
dataSource.DataSourceView = view;
+                                                       
dataSource.DataSourceSelectArguments = SelectArguments;
+                                                       
dataSource.SetItemCountFromPageIndex (PageIndex + 
PagerSettings.PageButtonCount);
+                                               }
+                                       }
+                               }
+                               
+                               pageCount = dataSource.PageCount;
+                       }
+                       else
+                       {
+                               dataSource = new PagedDataSource ();
+                               dataSource.DataSource = data;
+                               if (AllowPaging) {
+                                       dataSource.AllowPaging = true;
+                                       dataSource.PageSize = PageSize;
+                                       dataSource.CurrentPageIndex = PageIndex;
+                                       Console.WriteLine ("CPI:" + PageIndex + 
" " + dataSource.CurrentPageIndex);
+                               }
+                       }
+
                        bool showPager = AllowPaging && (PageCount > 1);
                        
                        Controls.Clear ();
@@ -893,36 +1112,28 @@
                        ArrayList list = new ArrayList ();
                        ArrayList keyList = new ArrayList ();
                        
-                       DataControlField[] fields;
+                       // Creates the set of fields to show
                        
-                       if (AutoGenerateEditButton || AutoGenerateDeleteButton 
|| AutoGenerateSelectButton) {
-                               commandField = new CommandField ();
-                               commandField.ShowEditButton = 
AutoGenerateEditButton;
-                               commandField.ShowDeleteButton = 
AutoGenerateDeleteButton;
-                               commandField.ShowSelectButton = 
AutoGenerateSelectButton;
-                               fields = new DataControlField [Columns.Count + 
1];
-                               fields [0] = commandField;
-                               Columns.CopyTo (fields, 1);
-                       } else {
-                               fields = new DataControlField [Columns.Count];
-                               Columns.CopyTo (fields, 0);
-                       }
+                       ICollection fieldCollection = CreateColumns 
(dataSource, dataBinding);
+                       DataControlField[] fields = new DataControlField 
[fieldCollection.Count];
+                       fieldCollection.CopyTo (fields, 0);
 
                        foreach (DataControlField field in fields)
                                field.Initialize (AllowSorting, this);
+
+                       // Main table creation
                        
                        if (showPager && PagerSettings.Position == 
PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) {
-                               topPagerRow = CreatePagerRow ();
+                               topPagerRow = CreatePagerRow (fields.Length, 
dataSource);
                                table.Rows.Add (topPagerRow);
                        }
-                               
+
                        if (ShowHeader) {
                                headerRow = CreateRow (0, 0, 
DataControlRowType.Header, DataControlRowState.Normal);
                                table.Rows.Add (headerRow);
                                InitializeRow (headerRow, fields);
                        }
                        
-                       int n = 0;
                        foreach (object obj in dataSource) {
                                DataControlRowState rstate = GetRowState 
(list.Count);
                                GridViewRow row = CreateRow (list.Count, 
list.Count, DataControlRowType.DataRow, rstate);
@@ -934,7 +1145,7 @@
                                        row.DataBind ();
                                        OnRowDataBound (new 
GridViewRowEventArgs (row));
                                        if (EditIndex == row.RowIndex)
-                                               oldEditValues = new DataKey 
(GetRowValues (row));
+                                               oldEditValues = new DataKey 
(GetRowValues (row, false, true));
                                        keyList.Add (new DataKey 
(CreateRowDataKey (row), DataKeyNames));
                                } else {
                                        if (EditIndex == row.RowIndex)
@@ -942,9 +1153,12 @@
                                        keyList.Add (new DataKey (new 
OrderedDictionary (), DataKeyNames));
                                }
 
-                               if (n >= PageSize)
+                               if (list.Count >= PageSize)
                                        break;
                        }
+                       
+                       if (list.Count == 0)
+                               table.Rows.Add (CreateEmptyrRow 
(fields.Length));
 
                        if (ShowFooter) {
                                footerRow = CreateRow (0, 0, 
DataControlRowType.Footer, DataControlRowState.Normal);
@@ -953,18 +1167,14 @@
                        }
 
                        if (showPager && PagerSettings.Position == 
PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) {
-                               if (pagerTemplate != null)
-                                       pagerTemplate.InstantiateIn (this);
-                               else {
-                                       bottomPagerRow = CreatePagerRow ();
-                                       table.Rows.Add (bottomPagerRow);
-                               }
+                               bottomPagerRow = CreatePagerRow (fields.Length, 
dataSource);
+                               table.Rows.Add (bottomPagerRow);
                        }
 
                        rows = new GridViewRowCollection (list);
                        keys = new DataKeyArray (keyList);
                        
-                       return list.Count;
+                       return dataSource.DataSourceCount;
                }
                
                DataControlRowState GetRowState (int index)
@@ -975,29 +1185,66 @@
                        return rstate;
                }
                
-               GridViewRow CreatePagerRow ()
+               GridViewRow CreatePagerRow (int fieldCount, PagedDataSource 
dataSource)
                {
                        GridViewRow row = CreateRow (-1, -1, 
DataControlRowType.Pager, DataControlRowState.Normal);
+                       InitializePager (row, fieldCount, dataSource);
+                       return row;
+               }
+               
+               protected virtual void InitializePager (GridViewRow row, int 
columnSpan, PagedDataSource dataSource)
+               {
                        TableCell cell = new TableCell ();
-                       cell.ColumnSpan = row.Cells.Count;
-                       cell.Controls.Add (PagerSettings.CreatePagerControl 
(PageIndex, PageCount));
+                       cell.ColumnSpan = columnSpan;
+                       
+                       if (pagerTemplate != null)
+                               pagerTemplate.InstantiateIn (cell);
+                       else
+                               cell.Controls.Add 
(PagerSettings.CreatePagerControl (dataSource.CurrentPageIndex, 
dataSource.PageCount));
+                       
                        row.Cells.Add (cell);
+               }
+               
+               GridViewRow CreateEmptyrRow (int fieldCount)
+               {
+                       GridViewRow row = CreateRow (-1, -1, 
DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
+                       TableCell cell = new TableCell ();
+                       cell.ColumnSpan = fieldCount;
+                       
+                       if (emptyDataTemplate != null)
+                               emptyDataTemplate.InstantiateIn (cell);
+                       else
+                               cell.Text = EmptyDataText;
+                       
+                       row.Cells.Add (cell);
                        return row;
                }
                
                protected virtual void InitializeRow (GridViewRow row, 
DataControlField[] fields)
                {
                        DataControlCellType ctype;
+                       bool accessibleHeader = false;
 
                        switch (row.RowType) {
-                               case DataControlRowType.Header: ctype = 
DataControlCellType.Header; break;
-                               case DataControlRowType.Footer: ctype = 
DataControlCellType.Footer; break;
-                               default: ctype = DataControlCellType.DataCell; 
break;
+                               case DataControlRowType.Header:
+                                       ctype = DataControlCellType.Header; 
+                                       accessibleHeader = UseAccessibleHeader;
+                                       break;
+                               case DataControlRowType.Footer:
+                                       ctype = DataControlCellType.Footer;
+                                       break;
+                               default:
+                                       ctype = DataControlCellType.DataCell;
+                                       break;
                        }
-
+                       
                        for (int n=0; n<fields.Length; n++) {
                                DataControlField field = fields [n];
-                               DataControlFieldCell cell = new 
DataControlFieldCell (field);
+                               DataControlFieldCell cell;
+                               if (((field is BoundField) && 
((BoundField)field).DataField == RowHeaderColumn) || accessibleHeader)
+                                       cell = new 
AccessibleDataControlFieldCell (accessibleHeader, field);
+                               else
+                                       cell = new DataControlFieldCell (field);
                                row.Cells.Add (cell);
                                field.InitializeCell (cell, ctype, 
row.RowState, row.RowIndex);
                        }
@@ -1017,17 +1264,23 @@
                        return dic;
                }
                
-               IOrderedDictionary GetRowValues (GridViewRow row)
+               IOrderedDictionary GetRowValues (GridViewRow row, bool 
includeReadOnlyFields, bool includePrimaryKey)
                {
                        OrderedDictionary dic = new OrderedDictionary ();
-                       
+                       ExtractRowValues (dic, row, includeReadOnlyFields, 
includePrimaryKey);
+                       return dic;
+               }
+               
+               protected virtual void ExtractRowValues (IOrderedDictionary 
fieldValues, GridViewRow row, bool includeReadOnlyFields, bool 
includePrimaryKey)
+               {
                        foreach (TableCell cell in row.Cells) {
                                DataControlFieldCell c = cell as 
DataControlFieldCell;
                                if (c != null)
-                                       c.ContainingField.ExtractValuesFromCell 
(dic, c, row.RowState, true);
+                                       c.ContainingField.ExtractValuesFromCell 
(fieldValues, c, row.RowState, includeReadOnlyFields);
                        }
-                       
-                       return dic;
+                       if (!includePrimaryKey && DataKeyNames != null)
+                               foreach (string key in DataKeyNames)
+                                       fieldValues.Remove (key);
                }
                
                protected override HtmlTextWriterTag TagKey {
@@ -1041,12 +1294,17 @@
                
                public sealed override void DataBind ()
                {
-                       if (AllowPaging) {
+                       DataSourceView view = GetData ();
+                       if (AllowPaging && view.CanPage) {
                                SelectArguments.StartRowIndex = PageIndex * 
PageSize;
                                SelectArguments.MaximumRows = PageSize;
-                               SelectArguments.RetrieveTotalRowCount = true;
+                               if (view.CanRetrieveTotalRowCount)
+                                       SelectArguments.RetrieveTotalRowCount = 
true;
+                       }
+
+                       if (sortExpression != "")
                                SelectArguments.SortExpression = sortExpression;
-                       }
+                               
                        base.DataBind ();
                }
                
@@ -1063,8 +1321,7 @@
                
                void OnFieldsChanged (object sender, EventArgs args)
                {
-                       if (Initialized)
-                               RequireBinding ();
+                       RequireBinding ();
                }
                
                protected override void OnDataPropertyChanged ()
@@ -1136,7 +1393,7 @@
                                        break;
                                        
                                case "Update":
-                                       UpdateRow ();
+                                       UpdateRow (EditIndex, true);
                                        break;
                                        
                                case "Cancel":
@@ -1228,25 +1485,25 @@
                        }
                }
 
-               void UpdateRow ()
+               [MonoTODO ("Support two-way binding expressions")]
+               public virtual void UpdateRow (int rowIndex, bool 
causesValidation)
                {
-                       GridViewRow row = Rows [EditIndex];
-                       currentEditRowKeys = DataKeys [EditIndex].Values;
-                       currentEditNewValues = GetRowValues (row);
+                       if (causesValidation)
+                               Page.Validate ();
+                       
+                       if (rowIndex != EditIndex) throw new 
NotSupportedException ();
+                       
+                       GridViewRow row = Rows [rowIndex];
+                       currentEditRowKeys = DataKeys [rowIndex].Values;
+                       currentEditNewValues = GetRowValues (row, false, true);
                        currentEditOldValues = oldEditValues.Values;
                        
                        GridViewUpdateEventArgs args = new 
GridViewUpdateEventArgs (EditIndex, currentEditRowKeys, currentEditOldValues, 
currentEditNewValues);
                        OnRowUpdating (args);
                        if (!args.Cancel) {
                                DataSourceView view = GetData ();
-                               if (view != null)
-                                       view.Update (currentEditRowKeys, 
currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback 
(UpdateCallback));
-                               else {
-                                       GridViewUpdatedEventArgs dargs = new 
GridViewUpdatedEventArgs (0, null, currentEditRowKeys, currentEditOldValues, 
currentEditNewValues);
-                                       OnRowUpdated (dargs);
-                                       if (!dargs.KeepInEditMode)              
                
-                                               EndRowEdit ();
-                               }
+                               if (view == null) throw new HttpException ("The 
DataSourceView associated to data bound control was null");
+                               view.Update (currentEditRowKeys, 
currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback 
(UpdateCallback));
                        } else
                                EndRowEdit ();
                }
@@ -1266,7 +1523,7 @@
                {
                        GridViewRow row = Rows [rowIndex];
                        currentEditRowKeys = DataKeys [rowIndex].Values;
-                       currentEditNewValues = GetRowValues (row);
+                       currentEditNewValues = GetRowValues (row, true, true);
                        
                        GridViewDeleteEventArgs args = new 
GridViewDeleteEventArgs (rowIndex, currentEditRowKeys, currentEditNewValues);
                        OnRowDeleting (args);
@@ -1333,11 +1590,15 @@
                        if (editRowStyle != null) 
((IStateManager)editRowStyle).TrackViewState();
                        if (emptyDataRowStyle != null) 
((IStateManager)emptyDataRowStyle).TrackViewState();
                        if (keys != null) 
((IStateManager)keys).TrackViewState();
+                       if (autoFieldProperties != null) {
+                               foreach (IStateManager sm in 
autoFieldProperties)
+                                       sm.TrackViewState ();
+                       }
                }
 
                protected override object SaveViewState()
                {
-                       object[] states = new object [13];
+                       object[] states = new object [14];
                        states[0] = base.SaveViewState();
                        states[1] = (columns == null ? null : 
((IStateManager)columns).SaveViewState());
                        states[2] = (pagerSettings == null ? null : 
((IStateManager)pagerSettings).SaveViewState());
@@ -1351,6 +1612,16 @@
                        states[10] = (emptyDataRowStyle == null ? null : 
((IStateManager)emptyDataRowStyle).SaveViewState());
                        states[11] = (keys == null ? null : 
((IStateManager)keys).SaveViewState());
                        states[12] = (oldEditValues == null ? null : 
((IStateManager)oldEditValues).SaveViewState());
+                       
+                       if (autoFieldProperties != null) {
+                               object[] data = new object 
[autoFieldProperties.Length];
+                               bool allNull = true;
+                               for (int n=0; n<data.Length; n++) {
+                                       data [n] = 
((IStateManager)autoFieldProperties [n]).SaveViewState ();
+                                       if (data [n] != null) allNull = false;
+                               }
+                               if (!allNull) states [13] = data;
+                       }
 
                        for (int i = states.Length - 1; i >= 0; i--) {
                                if (states [i] != null)
@@ -1382,6 +1653,17 @@
                        if (states[10] != null) 
((IStateManager)EmptyDataRowStyle).LoadViewState (states[10]);
                        if (states[11] != null) 
((IStateManager)DataKeys).LoadViewState (states[11]);
                        if (states[12] != null && oldEditValues != null) 
((IStateManager)oldEditValues).LoadViewState (states[12]);
+                       
+                       if (states[13] != null) {
+                               object[] data = (object[]) states [13];
+                               autoFieldProperties = new 
AutoGeneratedFieldProperties [data.Length];
+                               for (int n=0; n<data.Length; n++) {
+                                       IStateManager p = new 
AutoGeneratedFieldProperties ();
+                                       p.TrackViewState ();
+                                       p.LoadViewState (data [n]);
+                                       autoFieldProperties [n] = 
(AutoGeneratedFieldProperties) p;
+                               }
+                       }
                }
                
                string ICallbackEventHandler.RaiseCallbackEvent (string 
eventArgs)

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs     
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs     
2005-03-23 17:20:57 UTC (rev 42154)
@@ -47,6 +47,12 @@
                private int  currentPageIndex;
                private bool allowCustomPaging;
                private int  virtualCount;
+               
+#if NET_2_0
+               DataSourceSelectArguments arguments;
+               DataSourceView view;
+               bool serverPaging;
+#endif
 
                private IEnumerable dataSource;
 
@@ -64,6 +70,44 @@
                        virtualCount      = 0;
                }
 
+#if NET_2_0
+               public DataSourceSelectArguments DataSourceSelectArguments {
+                       get { return arguments; }
+                       set { arguments = value; }
+               }
+
+               public DataSourceView DataSourceView {
+                       get { return view; }
+                       set { view = value; }
+               }
+
+               public bool AllowServerPaging {
+                       get { return serverPaging; }
+                       set { serverPaging = value; }
+               }
+               
+               public bool IsServerPagingEnabled {
+                       get { return allowPaging && serverPaging; }
+               }
+               
+               public void SetItemCountFromPageIndex (int highestPageIndex)
+               {
+                       arguments.StartRowIndex = CurrentPageIndex * PageSize;
+                       arguments.MaximumRows = (highestPageIndex - 
CurrentPageIndex) * PageSize + 1;
+                       IEnumerable data = view.ExecuteSelect (arguments);
+                       
+                       virtualCount = CurrentPageIndex * PageSize;
+                       if (data is ICollection) {
+                               virtualCount += ((ICollection)data).Count;
+                       } else {
+                               IEnumerator e = data.GetEnumerator ();
+                               while (e.MoveNext())
+                                       virtualCount++;
+                       }
+               }
+
+#endif
+
                public bool AllowCustomPaging
                {
                        get
@@ -143,6 +187,12 @@
                        {
                                if(dataSource != null)
                                {
+#if NET_2_0
+                                       if (serverPaging)
+                                       {
+                                               return virtualCount;
+                                       }
+#endif
                                        if(IsCustomPagingEnabled)
                                        {
                                                return virtualCount;
@@ -263,7 +313,7 @@
                                virtualCount = value;
                        }
                }
-
+               
                public void CopyTo(Array array, int index)
                {
                        IEnumerator enumerator = this.GetEnumerator();
@@ -275,8 +325,13 @@
 
                public IEnumerator GetEnumerator()
                {
+#if NET_2_0
+                       int fInd = serverPaging ? 0 : FirstIndexInPage;
+#else
                        int fInd = FirstIndexInPage;
+#endif
                        int count = -1;
+
                        if(dataSource is ICollection)
                        {
                                count = Count;

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs       
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs       
2005-03-23 17:20:57 UTC (rev 42154)
@@ -284,7 +284,7 @@
                                }
                                
                                for (int n = first; n < last; n++)
-                                       row.Cells.Add (CreateCell 
(n.ToString(), string.Empty, (n != currentPage) ? "Page" + n : "", 
n.ToString()));
+                                       row.Cells.Add (CreateCell 
(n.ToString(), string.Empty, (n != currentPage) ? "Page" : "", n.ToString()));
                                
                                if (last < pageCount - 1) {
                                        row.Cells.Add (CreateCell 
(NextPageText, NextPageImageUrl, "Page", "Next"));

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs   
2005-03-23 17:07:26 UTC (rev 42153)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs   
2005-03-23 17:20:57 UTC (rev 42154)
@@ -59,13 +59,6 @@
                        PreventAutoID ();
                }
 
-#if NET_2_0
-               public TableCell (string text) : this ()
-               {
-                       Text = text;
-               }
-#endif
-
 #if !NET_2_0
                [Bindable (true)]
 #endif
@@ -212,7 +205,7 @@
 
                protected override void RenderContents (HtmlTextWriter writer)
                {
-                       if (HasControls ())
+                       if (HasControls () || HasRenderMethodDelegate ())
                                base.RenderContents (writer);
                        else
                                writer.Write (Text);

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

Reply via email to