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

作成される行またはデータにバインドされる行を表す GridViewRow オブジェクト。

Row プロパティを使用して、作成される行またはデータにバインドされる行のプロパティにアクセスします。行の特定のセルにアクセスするには、Row プロパティに格納されている GridViewRow オブジェクトの Cells プロパティを使用します。GridViewRow オブジェクトの RowType プロパティを使用して、作成される行の種類 (ヘッダー行、データ行など) を確認できます。

Row プロパティを使用して、データにバインドされる行のプロパティにアクセスする方法を次の例に示します。
<%@ Page language="VB" %> <script runat="server"> Sub CustomersGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then ' Display the company name in italics. e.Row.Cells(1).Text = "<i>" & e.Row.Cells(1).Text & "</i>" End If End Sub </script> <html> <body> <form runat="server"> <h3>GridView RowDataBound Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSqlDataSource" autogeneratecolumns="true" allowpaging="true" onrowdatabound="CustomersGridView_RowDataBound" runat="server"> </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="CustomersSqlDataSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"> </asp:sqldatasource> </form> </body> </html>
<%@ Page language="C#" %> <script runat="server"> void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { // Display the company name in italics. e.Row.Cells[1].Text = "<i>" + e.Row.Cells[1].Text + "</i>"; } } </script> <html> <body> <form runat="server"> <h3>GridView RowDataBound Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSqlDataSource" autogeneratecolumns="true" allowpaging="true" onrowdatabound="CustomersGridView_RowDataBound" runat="server"> </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="CustomersSqlDataSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"> </asp:sqldatasource> </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に収録されているすべての辞書からGridViewRowEventArgs.Row プロパティを検索する場合は、下記のリンクをクリックしてください。

- GridViewRowEventArgs.Row プロパティのページへのリンク