[Mono-bugs] [Bug 73864][Nor] Changed - DataGrid.PageCount behaviour inconsistent with MS' .NET

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 30 Mar 2005 11:08:27 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by tsureshkumar@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=73864

--- shadow/73864	2005-03-30 10:24:30.000000000 -0500
+++ shadow/73864.tmp.29205	2005-03-30 11:08:27.000000000 -0500
@@ -160,6 +160,28 @@
                         }
                         return null;
                 }
 
 IMHO, no need to check for a column number > 0 , just return the empty
 column array list. A zero element collection needs to be supported.
+
+------- Additional Comments From tsureshkumar@novell.com  2005-03-30 11:08 -------
+patch to return pagecount of atleast 1.  If paging is enabled and if
+the datasource have no items, still it has to return page count 1. 
+
+Index: System.Web.UI.WebControls/PagedDataSource.cs
+===================================================================
+--- System.Web.UI.WebControls/PagedDataSource.cs        (revision 41888)
++++ System.Web.UI.WebControls/PagedDataSource.cs        (working copy)
+@@ -226,7 +226,8 @@
+                                                return 1;
+
+                                        int total = DataSourceCount;
+-                                       return (total + pageSize -
+1)/pageSize;
++                                       int pages = (total + pageSize
+- 1)/pageSize;
++                                        return pages > 0 ? pages : 1;
+                                }
+                                return 0;
+                        }
+