2010-04-01 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 1 Apr 2010 11:20:09 +0000 (11:20 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 1 Apr 2010 11:20:09 +0000 (11:20 -0000)
* FormView.cs: do not show the pager if PagerSettings.Visible is
false. Fixes bug #578863

2010-04-01  Marek Habersack  <mhabersack@novell.com>

* FormViewTest.cs: added test for bug #578863

svn path=/trunk/mcs/; revision=154631

mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs
mcs/class/System.Web/Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx [new file with mode: 0644]

index 9cd3b8efc8a732204a90ee43ddd57254ac23c606..9c4c88c926c170c3936a4804e10ca793b895cd73 100644 (file)
@@ -207,7 +207,8 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/CheckBoxList_Bug578770.aspx \
        Test/mainsoft/NunitWebResources/EnumConverter_Bug578586.aspx \
        Test/mainsoft/NunitWebResources/ButtonColor_Bug325489.aspx \
-       Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx
+       Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx \
+       Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx
 
 RESX_DIST =  resources/TranslationResources.resx
 ifneq (1, $(FRAMEWORK_VERSION_MAJOR))
index 03253f0f1ece9d98f5a4f66a0ea91cb37971e230..b222159792fca7d51fe808dfafbc599c6c3112c1 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-01  Marek Habersack  <mhabersack@novell.com>
+
+       * FormView.cs: do not show the pager if PagerSettings.Visible is
+       false. Fixes bug #578863
+
 2010-03-29  Marek Habersack  <mhabersack@novell.com>
 
        * GridView.cs: main table must be created and added to the
index 7fdb4b9d2617ac9be9e26a6f6016aeffb90f53be..099ceb54126870937b3078e7a62e0b4d90078923 100644 (file)
@@ -898,7 +898,8 @@ namespace System.Web.UI.WebControls
                                }
                        }
 
-                       bool showPager = AllowPaging && (dataSource.PageCount > 1);
+                       PagerSettings pagerSettings = PagerSettings;
+                       bool showPager = AllowPaging && pagerSettings.Visible && (dataSource.PageCount > 1);
                        
                        Controls.Clear ();
                        table = CreateTable ();
@@ -947,8 +948,8 @@ namespace System.Web.UI.WebControls
                                InitializeRow (headerRow);
                                table.Rows.Add (headerRow);
                        }
-                       
-                       if (showPager && PagerSettings.Position == PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) {
+
+                       if (showPager && pagerSettings.Position == PagerPosition.Top || pagerSettings.Position == PagerPosition.TopAndBottom) {
                                topPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
                                InitializePager (topPagerRow, dataSource);
                                table.Rows.Add (topPagerRow);
@@ -981,7 +982,7 @@ namespace System.Web.UI.WebControls
                                table.Rows.Add (footerRow);
                        }
                        
-                       if (showPager && PagerSettings.Position == PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) {
+                       if (showPager && pagerSettings.Position == PagerPosition.Bottom || pagerSettings.Position == PagerPosition.TopAndBottom) {
                                bottomPagerRow = CreateRow (0, DataControlRowType.Pager, DataControlRowState.Normal);
                                InitializePager (bottomPagerRow, dataSource);
                                table.Rows.Add (bottomPagerRow);
index 31618d1dae7630e0eb439c33ecb0152bca00e70d..c0666e03438a6bb43310153d745dd373cd3c59d9 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-01  Marek Habersack  <mhabersack@novell.com>
+
+       * FormViewTest.cs: added test for bug #578863
+
 2010-02-19  Marek Habersack  <mhabersack@novell.com>
 
        * SqlDataSourceTest.cs: added test for bug #572781
index 134c69037a18b6a98c4ee360deb9893befaf58f9..fcec2e1ad3096f6ea544877e8826fcb043a7ec45 100644 (file)
@@ -385,6 +385,7 @@ namespace MonoTests.System.Web.UI.WebControls
                         WebTest.CopyResource (GetType (), "FormView.aspx", "FormView.aspx");
                         WebTest.CopyResource (GetType (), "FormViewTest1.aspx", "FormViewTest1.aspx");
                         WebTest.CopyResource (GetType (), "FormViewInsertEditDelete.aspx", "FormViewInsertEditDelete.aspx");
+                       WebTest.CopyResource (GetType (), "FormViewPagerVisibility.aspx", "FormViewPagerVisibility.aspx");
                }
                
 
@@ -1822,6 +1823,24 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
                        
                }
 
+               [Test (Description="Bug #578863")]
+               public void FormView_PagerSettings_Visibility ()
+               {
+                       string origHtml = @"<table id=""FormView1"" cellpadding=""3"" cellspacing=""2"" rules=""all"" border=""1"" style=""background-color:#DEBA84;border-color:#DEBA84;border-width:1px;border-style:None;""> 
+               <tr style=""background-color:#FFF7E7;color:#8C4510;""> 
+                       <td colspan=""2""> 
+          <span id=""FormView1_Label1"">1</span> 
+       </td> 
+               </tr> 
+       </table>";
+                       
+                       WebTest t = new WebTest ("FormViewPagerVisibility.aspx");
+                       string pageHtml = t.Run ();
+                       string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
+
+                       HtmlDiff.AssertAreEqual (origHtml, renderedHtml, "#A1");
+               }
+               
                [Test]
                [Category ("NunitWeb")]
                public void FormView_FireEvent_1 ()
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx
new file mode 100644 (file)
index 0000000..328a350
--- /dev/null
@@ -0,0 +1,38 @@
+<%@ Page Language="C#" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>Bug #578863</title>
+  </head>
+  <body>
+    <form id="form1" runat="server">
+      <%= MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><asp:FormView ID="FormView1" runat="server" AllowPaging="True" BackColor="#DEBA84"
+                   BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
+                   DataSourceID="ObjectDataSource1" GridLines="Both">
+       <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
+       <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
+       <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
+       <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
+       <ItemTemplate>
+          <asp:Label ID="Label1" runat="server" Text="<%# FormView1.DataItem.ToString() %>"></asp:Label>
+       </ItemTemplate>
+       <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
+       <PagerSettings Visible="false"/>
+      </asp:FormView><%= MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %>
+      <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
+                           DeleteMethod="DeleteList" InsertMethod="InsertList" SelectMethod="GetMyList"
+                           TypeName="MonoTests.System.Web.UI.WebControls.TestMyData" UpdateMethod="UpdateList">
+       <DeleteParameters>
+          <asp:Parameter Name="value" Type="Int32" />
+       </DeleteParameters>
+       <InsertParameters>
+          <asp:Parameter Name="value" Type="Int32" />
+       </InsertParameters>
+       <UpdateParameters>
+          <asp:Parameter Name="index" Type="Int32" />
+          <asp:Parameter Name="value" Type="Int32" />
+       </UpdateParameters>
+      </asp:ObjectDataSource>
+    </form>
+  </body>
+</html>