Author: igorz
Date: 2007-07-01 06:58:58 -0400 (Sun, 01 Jul 2007)
New Revision: 81139
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
Log:
2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
* GridView.cs:
the Pager is created but unvisible for only one page.
the Patch submitted by Dumitru Ban [EMAIL PROTECTED]
2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
* GridViewTest.cs:
Added new tests
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-07-01 09:28:15 UTC (rev 81138)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-07-01 10:58:58 UTC (rev 81139)
@@ -1,5 +1,11 @@
2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
+ * GridView.cs:
+ the Pager is created but unvisible for only one page.
+ the Patch submitted by Dumitru Ban [EMAIL PROTECTED]
+
+2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
+
* FormView.cs:
* DetailView.cs:
* GridView.cs:
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2007-07-01 09:28:15 UTC (rev 81138)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2007-07-01 10:58:58 UTC (rev 81139)
@@ -1263,8 +1263,8 @@
}
}
- bool showPager = AllowPaging && (PageCount > 1);
-
+ bool createPager = AllowPaging && (PageCount >= 1) &&
PagerSettings.Visible;
+
ArrayList list = new ArrayList ();
// Creates the set of fields to show
@@ -1297,7 +1297,7 @@
object obj = enumerator.Current;
if (list.Count == 0) {
- if (showPager &&
(PagerSettings.Position == PagerPosition.Top || PagerSettings.Position ==
PagerPosition.TopAndBottom)) {
+ if (createPager &&
(PagerSettings.Position == PagerPosition.Top || PagerSettings.Position ==
PagerPosition.TopAndBottom)) {
topPagerRow = CreatePagerRow
(fields.Length, dataSource);
OnRowCreated (new
GridViewRowEventArgs (topPagerRow));
ContainedTable.Rows.Add
(topPagerRow);
@@ -1305,6 +1305,8 @@
topPagerRow.DataBind ();
OnRowDataBound (new
GridViewRowEventArgs (topPagerRow));
}
+ if (PageCount == 1)
+ topPagerRow.Visible =
false;
}
GridViewRow headerRow = CreateRow (-1,
-1, DataControlRowType.Header, DataControlRowState.Normal);
@@ -1355,7 +1357,7 @@
OnRowDataBound (new
GridViewRowEventArgs (footerRow));
}
- if (showPager && (PagerSettings.Position ==
PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom)) {
+ if (createPager && (PagerSettings.Position ==
PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom)) {
bottomPagerRow = CreatePagerRow
(fields.Length, dataSource);
OnRowCreated (new GridViewRowEventArgs
(bottomPagerRow));
ContainedTable.Rows.Add
(bottomPagerRow);
@@ -1363,6 +1365,8 @@
bottomPagerRow.DataBind ();
OnRowDataBound (new
GridViewRowEventArgs (bottomPagerRow));
}
+ if (PageCount == 1)
+ bottomPagerRow.Visible = false;
}
}
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-07-01 09:28:15 UTC (rev 81138)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-07-01 10:58:58 UTC (rev 81139)
@@ -1,5 +1,10 @@
2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
+ * GridViewTest.cs:
+ Added new tests
+
+2007-07-01 Igor Zelmanovich <[EMAIL PROTECTED]>
+
* FormViewTest.cs:
* DetailViewTest.cs:
* GridViewTest.cs:
Modified:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
2007-07-01 09:28:15 UTC (rev 81138)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
2007-07-01 10:58:58 UTC (rev 81139)
@@ -3086,6 +3086,83 @@
public static void BuildTemplateMethod (Control c) { }
+ [Test]
+ [Category ("NunitWeb")]
+ public void GridView_Pager () {
+ PageDelegates delegates = new PageDelegates ();
+ delegates.Load = GridView_Pager_Load;
+ PageInvoker invoker = new PageInvoker (delegates);
+ WebTest t = new WebTest (invoker);
+ string html = t.Run ();
+ }
+
+ public static void GridView_Pager_Load (Page p) {
+ // TopAndBottom, PageCount = 1
+ PokerGridView grid = new PokerGridView ();
+ grid.PagerSettings.Position =
PagerPosition.TopAndBottom;
+ grid.AllowPaging = true;
+ p.Form.Controls.Add (grid);
+
+ grid.DataSource = new string [] { "A", "B", "C" };
+ grid.DataBind ();
+
+ Assert.AreEqual (1, grid.PageCount, "#1#PageCount");
+
+ Assert.IsNotNull (grid.TopPagerRow, "#1#TopPagerRow");
+ Assert.AreEqual (false, grid.TopPagerRow.Visible,
"#1#TopPagerRow.Visible");
+
+ Assert.IsNotNull (grid.BottomPagerRow,
"#1#BottomPagerRow");
+ Assert.AreEqual (false, grid.BottomPagerRow.Visible,
"#1#BottomPagerRow.Visible");
+
+ // Top, PageCount = 1
+ grid = new PokerGridView ();
+ grid.PagerSettings.Position = PagerPosition.Top;
+ grid.AllowPaging = true;
+ p.Form.Controls.Add (grid);
+
+ grid.DataSource = new string [] { "A", "B", "C" };
+ grid.DataBind ();
+
+ Assert.AreEqual (1, grid.PageCount, "#2#PageCount");
+
+ Assert.IsNotNull (grid.TopPagerRow, "#2#TopPagerRow");
+ Assert.AreEqual (false, grid.TopPagerRow.Visible,
"#2#TopPagerRow.Visible");
+
+ Assert.IsNull (grid.BottomPagerRow,
"#2#BottomPagerRow");
+
+ // Bottom, PageCount = 1
+ grid = new PokerGridView ();
+ grid.PagerSettings.Position = PagerPosition.Bottom;
+ grid.AllowPaging = true;
+ p.Form.Controls.Add (grid);
+
+ grid.DataSource = new string [] { "A", "B", "C" };
+ grid.DataBind ();
+
+ Assert.AreEqual (1, grid.PageCount, "#3#PageCount");
+
+ Assert.IsNull (grid.TopPagerRow, "#3#TopPagerRow");
+
+ Assert.IsNotNull (grid.BottomPagerRow,
"#3#BottomPagerRow");
+ Assert.AreEqual (false, grid.BottomPagerRow.Visible,
"#3#BottomPagerRow.Visible");
+
+ // PagerSettings.Visible = false, PageCount = 2
+ grid = new PokerGridView ();
+ grid.PagerSettings.Position =
PagerPosition.TopAndBottom;
+ grid.PagerSettings.Visible = false;
+ grid.AllowPaging = true;
+ grid.PageSize = 2;
+ p.Form.Controls.Add (grid);
+
+ grid.DataSource = new string [] { "A", "B", "C" };
+ grid.DataBind ();
+
+ Assert.AreEqual (2, grid.PageCount, "#3#PageCount");
+
+ Assert.IsNull (grid.TopPagerRow, "#3#TopPagerRow");
+ Assert.IsNull (grid.BottomPagerRow,
"#3#BottomPagerRow");
+ }
+
[TestFixtureTearDown]
public void TearDown()
{
@@ -3349,3 +3426,4 @@
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches