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

Public Overridable Property CellSpacing As Integer
Dim instance As GridView Dim value As Integer value = instance.CellSpacing instance.CellSpacing = value
/** @property */ public int get_CellSpacing () /** @property */ public void set_CellSpacing (int value)
セル間の間隔 (ピクセル単位)。既定値は、0 です。

CellSpacing プロパティを使用して、GridView コントロール内の隣接するセル間の間隔を制御します。この間隔は垂直方向と水平方向の両方に適用されます。セルの間隔は、コントロール全体で統一されています。行または列間のセルの間隔は個別に指定できません。
![]() |
---|
このプロパティに 0 よりも大きい値を設定し、GridLines プロパティをセルの境界線を表示する値に設定すると、隣接するセルの境界線の間にギャップが表示されます。このような場合は、CellSpacing プロパティによってギャップのサイズが制御されます。 |

CellSpacing プロパティを使用して、GridView コントロールの各セル間の間隔を宣言によって設定する方法を次のコード例に示します。
<%@ Page language="VB" %> <html> <body> <form runat="server"> <h3>GridView CellPadding and CellSpacing Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." cellpadding="10" cellspacing="5" 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="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <html> <body> <form runat="server"> <h3>GridView CellPadding and CellSpacing Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." cellpadding="10" cellspacing="5" 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="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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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