GridView.FooterRow プロパティ
アセンブリ: System.Web (system.web.dll 内)

GridView コントロールのフッター行を表す GridViewRow。

プログラムによって、GridView コントロールのフッター行を表す GridViewRow オブジェクトにアクセスするには、FooterRow プロパティを使用します。
![]() |
---|
FooterRow プロパティは、RowCreated イベントで GridView コントロールによってフッター行が作成された後にしか使用できません。 |
通常、このプロパティは、プログラムによってフッター行を操作する必要がある場合 (カスタム コンテンツを追加する場合など) に使用されます。FooterRow プロパティへの変更は、GridView コントロールが表示された後に行う必要があります。そうしないと、GridView コントロールによって変更が上書きされます。

FooterRow プロパティを使用して、フッター行に並べ替えの方向を表示する方法を次のコード例に示します。
<%@ Page language="VB" %> <script runat="server"> Sub CustomersGridView_DataBound(ByVal sender As Object, ByVal e As EventArgs) ' Get the header row. Dim headerRow As GridViewRow = CustomersGridView.HeaderRow ' Get the footer row. Dim footerRow As GridViewRow = CustomersGridView.FooterRow ' Set the font color of the header and footer rows ' based on the sort direction. Select Case CustomersGridView.SortDirection Case SortDirection.Ascending headerRow.ForeColor = System.Drawing.Color.Green footerRow.ForeColor = System.Drawing.Color.Green Case SortDirection.Descending headerRow.ForeColor = System.Drawing.Color.Red footerRow.ForeColor = System.Drawing.Color.Red Case Else headerRow.ForeColor = System.Drawing.Color.Black footerRow.ForeColor = System.Drawing.Color.Black End Select ' Display the sort order in the footer row. footerRow.Cells(0).Text = "Sort Order = " & CustomersGridView.SortDirection.ToString() End Sub </script> <html> <body> <form runat="server"> <h3>GridView HeaderRow and FooterRow Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." allowsorting="true" allowpaging="true" showheader="true" showfooter="true" ondatabound="CustomersGridView_DataBound" runat="server"> <headerstyle backcolor="LightCyan" forecolor="MediumBlue"/> <footerstyle backcolor="LightCyan" forecolor="MediumBlue"/> </asp:gridview> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <script runat="server"> void CustomersGridView_DataBound(Object sender, EventArgs e) { // Get the header row. GridViewRow headerRow = CustomersGridView.HeaderRow; // Get the footer row. GridViewRow footerRow = CustomersGridView.FooterRow; // Set the font color of the header and footer rows // based on the sort direction. switch (CustomersGridView.SortDirection) { case SortDirection.Ascending: headerRow.ForeColor = System.Drawing.Color.Green; footerRow.ForeColor = System.Drawing.Color.Green; break; case SortDirection.Descending: headerRow.ForeColor = System.Drawing.Color.Red; footerRow.ForeColor = System.Drawing.Color.Red; break; default: headerRow.ForeColor = System.Drawing.Color.Black; footerRow.ForeColor = System.Drawing.Color.Black; break; } // Display the sort order in the footer row. footerRow.Cells[0].Text = "Sort Order = " + CustomersGridView.SortDirection.ToString(); } </script> <html> <body> <form runat="server"> <h3>GridView HeaderRow and FooterRow Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." allowsorting="true" allowpaging="true" showheader="true" showfooter="true" ondatabound="CustomersGridView_DataBound" runat="server"> <headerstyle backcolor="LightCyan" forecolor="MediumBlue"/> <footerstyle backcolor="LightCyan" forecolor="MediumBlue"/> </asp:gridview> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からGridView.FooterRow プロパティを検索する場合は、下記のリンクをクリックしてください。

- GridView.FooterRow プロパティのページへのリンク