Author: gonzalo
Date: 2006-07-21 10:33:24 -0400 (Fri, 21 Jul 2006)
New Revision: 62863

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
Log:
2006-07-21 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * DetailsView.cs:
        * GridView.cs:
        * PagedDataSource.cs:
        * FormView.cs:
        * ImageButton.cs:
        * LinkButton.cs: implement GetPostBackOptions for the 2.0 controls that
        support it. The GridView control will no longer throw an exception when
        rendered in the paging mode. Patch by Marek Habersack. Fixes bug #78288.



Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-07-21 14:33:24 UTC (rev 62863)
@@ -1,3 +1,14 @@
+2006-07-21 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * DetailsView.cs:
+       * GridView.cs:
+       * PagedDataSource.cs:
+       * FormView.cs:
+       * ImageButton.cs:
+       * LinkButton.cs: implement GetPostBackOptions for the 2.0 controls that
+       support it. The GridView control will no longer throw an exception when
+       rendered in the paging mode. Patch by Marek Habersack. Fixes bug #78288.
+
 2006-07-20 Andrew Skiba <[EMAIL PROTECTED]>
 
        * DetailsView.cs: many fixes: initialize PageCount with 0; initialize

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs 
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs 
2006-07-21 14:33:24 UTC (rev 62863)
@@ -1014,11 +1014,6 @@
                                                dataSource.AllowServerPaging = 
true;
                                                if 
(view.CanRetrieveTotalRowCount)
                                                        dataSource.VirtualCount 
= SelectArguments.TotalRowCount;
-                                               else {
-                                                       
dataSource.DataSourceView = view;
-                                                       
dataSource.DataSourceSelectArguments = SelectArguments;
-                                                       
dataSource.SetItemCountFromPageIndex (PageIndex + 
PagerSettings.PageButtonCount);
-                                               }
                                        }
                                }
                                

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs    
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs    
2006-07-21 14:33:24 UTC (rev 62863)
@@ -830,11 +830,6 @@
                                        dataSource.AllowServerPaging = true;
                                        if (view.CanRetrieveTotalRowCount)
                                                dataSource.VirtualCount = 
SelectArguments.TotalRowCount;
-                                       else {
-                                               dataSource.DataSourceView = 
view;
-                                               
dataSource.DataSourceSelectArguments = SelectArguments;
-                                               
dataSource.SetItemCountFromPageIndex (PageIndex + 
PagerSettings.PageButtonCount);
-                                       }
                                }
                        }
 
@@ -1450,10 +1445,10 @@
                        table.RenderEndTag (writer);
                }
 
-               [MonoTODO]
                PostBackOptions IPostBackContainer.GetPostBackOptions 
(IButtonControl control)
                {
-                       throw new NotImplementedException ();
+                       Control ctrl = control as Control;
+                       return new PostBackOptions(ctrl);
                }
 
        }

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs    
2006-07-21 14:33:24 UTC (rev 62863)
@@ -1118,11 +1118,6 @@
                                                dataSource.AllowServerPaging = 
true;
                                                if 
(view.CanRetrieveTotalRowCount)
                                                        dataSource.VirtualCount 
= SelectArguments.TotalRowCount;
-                                               else {
-                                                       
dataSource.DataSourceView = view;
-                                                       
dataSource.DataSourceSelectArguments = SelectArguments;
-                                                       
dataSource.SetItemCountFromPageIndex (PageIndex + 
PagerSettings.PageButtonCount);
-                                               }
                                        }
                                }
                                

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs 
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs 
2006-07-21 14:33:24 UTC (rev 62863)
@@ -160,14 +160,12 @@
 #endif
                [DefaultValue ("")]
                [Editor ("System.Web.UI.Design.UrlEditor, "  + 
Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + 
Consts.AssemblySystem_Drawing)]
-               [MonoTODO]
-               public virtual string PostBackUrl
-               {
+               public virtual string PostBackUrl {
                        get {
-                               throw new NotImplementedException ();
+                               return ViewState.GetString ("PostBackUrl", 
String.Empty);
                        }
                        set {
-                               throw new NotImplementedException ();
+                               ViewState["PostBackUrl"] = value;
                        }
                }
 
@@ -226,10 +224,11 @@
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected virtual PostBackOptions GetPostBackOptions ()
                {
-                       throw new NotImplementedException ();
+                       return new PostBackOptions(this, PostBackUrl, null, 
false, true,
+                                                  false, true, 
CausesValidation,
+                                                  ValidationGroup);
                }
 #endif         
 

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs  
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs  
2006-07-21 14:33:24 UTC (rev 62863)
@@ -120,10 +120,11 @@
                }
 
 #if NET_2_0
-               [MonoTODO]
                protected virtual PostBackOptions GetPostBackOptions ()
                {
-                       throw new NotImplementedException ();
+                       return new PostBackOptions(this, PostBackUrl, null, 
false, true,
+                                                  false, true, 
CausesValidation,
+                                                  ValidationGroup);
                }
 #endif         
 
@@ -289,13 +290,12 @@
                [Themeable (false)]
                [UrlProperty ("*.aspx")]
                [DefaultValue ("")]
-               [MonoTODO]
                public virtual string PostBackUrl {
                        get {
-                               throw new NotImplementedException ();
+                               return ViewState.GetString ("PostBackUrl", 
String.Empty);
                        }
                        set {
-                               throw new NotImplementedException ();
+                               ViewState["PostBackUrl"] = value;
                        }
                }
 

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs     
2006-07-21 14:22:39 UTC (rev 62862)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs     
2006-07-21 14:33:24 UTC (rev 62863)
@@ -36,7 +36,7 @@
        public sealed class PagedDataSource : ICollection, IEnumerable, 
ITypedList
        {
                int page_size, current_page_index, virtual_count;
-               bool allow_paging, allow_custom_paging;
+               bool allow_paging, allow_custom_paging, allow_server_paging;
                IEnumerable source;
                
                public PagedDataSource ()
@@ -46,7 +46,14 @@
 
                public bool AllowCustomPaging {
                        get { return allow_custom_paging; }
-                       set { allow_custom_paging = value; }
+                       set { 
+                               allow_custom_paging = value; 
+#if NET_2_0
+                               // AllowCustomPaging and AllowServerPaging are 
mutually exclusive
+                               if (allow_custom_paging)
+                                       allow_server_paging = false;
+#endif
+                       }
                }
 
                public bool AllowPaging {
@@ -84,7 +91,11 @@
                                if (source == null)
                                        return 0;
                                
-                               if (IsCustomPagingEnabled)
+                               if (IsCustomPagingEnabled 
+#if NET_2_0
+                                   || IsServerPagingEnabled
+#endif
+                               )
                                        return virtual_count;
 
                                if (source is ICollection)
@@ -96,7 +107,11 @@
 
                public int FirstIndexInPage {
                        get {
-                               if (!IsPagingEnabled || IsCustomPagingEnabled 
|| source == null)
+                               if (!IsPagingEnabled || IsCustomPagingEnabled 
|| 
+#if NET_2_0
+                                   IsServerPagingEnabled || 
+#endif
+                                   source == null)
                                        return 0;
                                
                                return current_page_index * page_size;
@@ -107,6 +122,12 @@
                        get { return IsPagingEnabled && allow_custom_paging; }
                }
 
+#if NET_2_0
+               public bool IsServerPagingEnabled {
+                       get { return IsPagingEnabled && allow_server_paging; }
+               }
+#endif
+
                public bool IsFirstPage {
                        get { 
                                if (!allow_paging)
@@ -141,10 +162,10 @@
                        get {
                                if (source == null)
                                        return 0;
-
+                               
                                if (!IsPagingEnabled || DataSourceCount == 0 || 
page_size == 0)
                                        return 1;
-
+                               
                                return (DataSourceCount + page_size - 1) / 
page_size;
                        }
                }
@@ -163,40 +184,17 @@
                        set { virtual_count = value; }
                }
 #if NET_2_0
-               [MonoTODO]
                public bool AllowServerPaging {
                        get {
-                               throw new NotImplementedException ();
+                               return allow_server_paging;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               allow_server_paging = value;
+                               // AllowCustomPaging and AllowServerPaging are 
mutually exclusive
+                               if (allow_server_paging)
+                                       allow_custom_paging = false;
                        }
                }
-
-               [MonoTODO]
-               public DataSourceSelectArguments DataSourceSelectArguments {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               [MonoTODO]
-               public DataSourceView DataSourceView {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               public void SetItemCountFromPageIndex (int highestPageIndex)
-               {
-                       throw new NotImplementedException ();
-               }
 #endif
 
                public void CopyTo (Array array, int index)

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

Reply via email to