GridView.HorizontalAlign プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > GridView.HorizontalAlign プロパティの意味・解説 

GridView.HorizontalAlign プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

ページ上の GridView コントロールの水平方向の配置を取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Overridable Property
 HorizontalAlign As HorizontalAlign
Dim instance As GridView
Dim value As HorizontalAlign

value = instance.HorizontalAlign

instance.HorizontalAlign = value
public virtual HorizontalAlign HorizontalAlign { get;
 set; }
public:
virtual property HorizontalAlign HorizontalAlign {
    HorizontalAlign get ();
    void set (HorizontalAlign value);
}
/** @property */
public HorizontalAlign get_HorizontalAlign ()

/** @property */
public void set_HorizontalAlign (HorizontalAlign
 value)
public function get HorizontalAlign
 () : HorizontalAlign

public function set HorizontalAlign
 (value : HorizontalAlign)

プロパティ値
HorizontalAlign 値の 1 つ。既定値は HorizontalAlign.NotSet です。

解説解説

HorizontalAlign プロパティを使用して、ページ内の GridView コントロールの水平方向の配置を指定します。さまざまな水平方向の配置の一覧を次の表に示します。

配置の値

説明

HorizontalAlign.NotSet

GridView コントロールの水平方向の配置が設定されていません。

HorizontalAlign.Left

GridView コントロールはページ上に左寄せで表示されます。

HorizontalAlign.Center

GridView コントロールはページ上で中央に配置されます。

HorizontalAlign.Right

GridView コントロールはページ上に右寄せで表示されます。

HorizontalAlign.Justify

GridView コントロールはページ上で左右の余白に揃えて配置されます。

使用例使用例

HorizontalAlign プロパティを使用して、GridView コントロールをページの右側に揃えて配置する方法を次のコード例に示します。

<%@ Page language="VB" %>

<html>
  <body>
    <form runat="server">
        
      <h3>GridView HorizontalAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        horizontalalign="Right"
        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#" %>

<html>
  <body>
    <form runat="server">
        
      <h3>GridView HorizontalAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        horizontalalign="Right"
        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>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GridView クラス
GridView メンバ
System.Web.UI.WebControls 名前空間
HorizontalAlign



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

GridView.HorizontalAlign プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



GridView.HorizontalAlign プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS