diff options
author | Marek Habersack <grendel@twistedcode.net> | 2010-04-01 15:20:33 +0400 |
---|---|---|
committer | Marek Habersack <grendel@twistedcode.net> | 2010-04-01 15:20:33 +0400 |
commit | 8ec1e8d0c916f08114247d4655340b5455dcd3ed (patch) | |
tree | bffd95dd7e5ef9515b6322a85106e303e2b1e9d1 /mcs | |
parent | 7aab767a0551df6f2f0e8b8f7533c087a91f1768 (diff) |
Backport of r154631
svn path=/branches/mono-2-6/mcs/; revision=154632
Diffstat (limited to 'mcs')
6 files changed, 75 insertions, 5 deletions
diff --git a/mcs/class/System.Web/Makefile b/mcs/class/System.Web/Makefile index 8c1d08c4d97..4f0e159807b 100644 --- a/mcs/class/System.Web/Makefile +++ b/mcs/class/System.Web/Makefile @@ -208,7 +208,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)) diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index 9edd9b79871..ebbb55a1355 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -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 diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs index 7fdb4b9d261..099ceb54126 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs @@ -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); diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog index e93fc907ab7..c5020716e02 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog @@ -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 diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs index 5cd1e12a7aa..4dacdf537e3 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs @@ -388,10 +388,13 @@ namespace MonoTests.System.Web.UI.WebControls "FormViewTest1.aspx"); WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.FormViewInsertEditDelete.aspx", "FormViewInsertEditDelete.aspx"); + WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.FormViewPagerVisibility.aspx", + "FormViewPagerVisibility.aspx"); #else 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"); #endif } @@ -1831,6 +1834,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 index 00000000000..328a3500465 --- /dev/null +++ b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx @@ -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> |