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))
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
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)
{
if (table == null)
return;
-
+
table.Caption = Caption;
table.CaptionAlign = CaptionAlign;
table.CopyBaseAttributes (this);
protected internal override void Render (HtmlTextWriter writer)
{
PrepareControlHierarchy ();
-
if (EnableSortingAndPagingCallbacks)
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID + "_div");
writer.RenderBeginTag (HtmlTextWriterTag.Div);
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");
+ }
+
+ [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 ()
{
--- /dev/null
+<%@ 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>