Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Habersack <grendel@twistedcode.net>2010-04-14 01:31:55 +0400
committerMarek Habersack <grendel@twistedcode.net>2010-04-14 01:31:55 +0400
commitdcb44d84c5cd6c241124c12b683a3496c14b8d59 (patch)
tree1f5a74f9379b100d53782ac45c70dd709598e7f8
parentc57cdde726c358fc30b96fa532dbd55c6919a3df (diff)
Backport of r155331
svn path=/branches/mono-2-6/mcs/; revision=155332
-rw-r--r--mcs/class/System.Web/Makefile3
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog3
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs11
-rw-r--r--mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs25
-rw-r--r--mcs/class/System.Web/Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx28
5 files changed, 67 insertions, 3 deletions
diff --git a/mcs/class/System.Web/Makefile b/mcs/class/System.Web/Makefile
index d06991b6001..67a8db8d540 100644
--- a/mcs/class/System.Web/Makefile
+++ b/mcs/class/System.Web/Makefile
@@ -223,7 +223,8 @@ TEST_RESOURCE_FILES = \
Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_2.aspx \
Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_5.aspx \
Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_6.aspx \
- Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx
+ Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx \
+ Test/mainsoft/NunitWebResources/GridView_Bug595567.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 7e5c23e2bb2..b367a912f38 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
@@ -1,5 +1,8 @@
2010-04-13 Marek Habersack <mhabersack@novell.com>
+ * GridView.cs: make sure Header and Footer visibility are set when
+ binding the data. Fixes bug #595567
+
* ImageField.cs, CheckBoxField.cs: OnDataBindField must expect
sender to be something else than DataControlFieldCell. Fixes bug
#595568
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
index 72af5103949..3715d6c31a5 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
@@ -1556,6 +1556,14 @@ namespace System.Web.UI.WebControls
base.DataBind ();
keys = new DataKeyArray (DataKeyArrayList);
+
+ GridViewRow row = HeaderRow;
+ if (row != null)
+ row.Visible = ShowHeader;
+
+ row = FooterRow;
+ if (row != null)
+ row.Visible = ShowFooter;
}
protected internal override void PerformDataBinding (IEnumerable data)
@@ -1567,7 +1575,7 @@ namespace System.Web.UI.WebControls
{
if (table == null)
return;
-
+
table.Caption = Caption;
table.CaptionAlign = CaptionAlign;
table.CopyBaseAttributes (this);
@@ -2189,7 +2197,6 @@ namespace System.Web.UI.WebControls
protected internal override void Render (HtmlTextWriter writer)
{
PrepareControlHierarchy ();
-
if (EnableSortingAndPagingCallbacks)
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID + "_div");
writer.RenderBeginTag (HtmlTextWriterTag.Div);
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
index 04222e5e50e..987d9bf6140 100644
--- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
+++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
@@ -440,14 +440,39 @@ namespace MonoTests.System.Web.UI.WebControls
WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.NoEventValidation.aspx", "NoEventValidation.aspx");
WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.TableSections_Bug551666.aspx", "TableSections_Bug551666.aspx");
WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.TableSections_Bug551666.aspx.cs", "TableSections_Bug551666.aspx.cs");
+ WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.GridView_Bug595567.aspx", "GridView_Bug595567.aspx");
#else
WebTest.CopyResource (GetType (), "GridViewUpdate.aspx", "GridViewUpdate.aspx");
WebTest.CopyResource (GetType (), "NoEventValidation.aspx", "NoEventValidation.aspx");
WebTest.CopyResource (GetType (), "TableSections_Bug551666.aspx", "TableSections_Bug551666.aspx");
WebTest.CopyResource (GetType (), "TableSections_Bug551666.aspx.cs", "TableSections_Bug551666.aspx.cs");
+ WebTest.CopyResource (GetType (), "GridView_Bug595567.aspx", "GridView_Bug595567.aspx");
#endif
}
+ [Test (Description="Bug 595567")]
+ public void HeaderFooterVisibility_Bug595567 ()
+ {
+ WebTest t = new WebTest ("GridView_Bug595567.aspx");
+ string originalHtml = @"<div>
+ <table id=""gridView"" cellspacing=""0"" rules=""all"" border=""1"" style=""border-collapse:collapse;"">
+ <tr>
+ <th scope=""col"">Item</th>
+ </tr><tr>
+ <td>0</td>
+ </tr><tr>
+ <td>0</td>
+ </tr><tr>
+ <td>0</td>
+ </tr>
+ </table>
+ </div>";
+ string pageHtml = t.Run ();
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
+
+ HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
+ }
+
[Test]
public void GridView_DefaultProperties ()
{
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx
new file mode 100644
index 00000000000..e16ea71bfe0
--- /dev/null
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx
@@ -0,0 +1,28 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+<script runat="server">
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (IsPostBack) return;
+
+ gridView.DataSource = new int[3];
+ gridView.DataBind();
+
+ GridViewRow row = gridView.FooterRow;
+ if (row.RowType == DataControlRowType.Footer && !gridView.ShowFooter && row.Visible)
+ throw new InvalidOperationException("Unexpected state: GridView.ShowFooter is False but the Footer row is Visible!");
+ }
+</script>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ <%= MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><asp:GridView runat="server" ID="gridView" /><%= MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %>
+ </div>
+ </form>
+</body>
+</html>