[Mono-devel-list] [patch] #73864: DataGrind.PageCount should be >0.

Sureshkumar T tsureshkumar at novell.com
Wed Mar 30 10:05:00 EST 2005


This patch fixes bug #73864 (DataGrid, System.Web).

If nobody has any objection, this would go into svn.

This fix is based the assumptions

1. datagrid.datasource can have empty list. so AutoCreateColumns should
return empty column list.
2. datagrid.Pagecount always should be >= 1. i.e. atleast a page.


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;
                        }
Index: System.Web.UI.WebControls/DataGrid.cs
===================================================================
--- System.Web.UI.WebControls/DataGrid.cs       (revision 41888)
+++ System.Web.UI.WebControls/DataGrid.cs       (working copy)
@@ -1580,11 +1580,7 @@

((IDisposable)props).Dispose();
                                        }
                                }
-                               if(retVal.Count > 0)
-                               {
-                                       return retVal;
-                               }
-                               throw new
HttpException(HttpRuntime.FormatResourceString("DataGrid_NoAutoGenColumns", ID));
+                                return retVal;
                        }
                        return null;
                }


suresh.



More information about the Mono-devel-list mailing list