TableCell クラスとは? わかりやすく解説

TableCell クラス

Table コントロールセル表します

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

<BindableAttribute(False)> _
Public Class TableCell
    Inherits WebControl
[BindableAttribute(false)] 
public class TableCell : WebControl
[BindableAttribute(false)] 
public ref class TableCell : public
 WebControl
/** @attribute BindableAttribute(false) */ 
public class TableCell extends WebControl
BindableAttribute(false) 
public class TableCell extends
 WebControl
解説解説

TableCell クラスTable コントロールセル表しますText プロパティ使用してセル内容指定または確認します

TableCell クラス使用してセル内容表示する方法制御できますセル内容配置は、HorizontalAlign プロパティと VerticalAlign プロパティ設定により指定されます。セル内容セル内で折り返すかどうか指定するには、Wrap プロパティ使用します

また、それぞれのセル使用するTable コントロールによって表されるテーブル内の行数または列数も指定できます。RowSpan プロパティ使用される行数制御し、ColumnSpan プロパティ使用される列数を制御します

注意に関するメモ注意

このコントロールは、ユーザー入力表示するために使用できますユーザー入力には悪意のあるクライアント スクリプト含まれている可能性ありますアプリケーション表示する前にクライアントから送信され実行スクリプトSQL ステートメントなどのコード情報はすべて検査してくださいASP.NET には入力要求検証機能があり、ユーザー入力の中のスクリプトHTMLブロックできます検証サーバー コントロールは、ユーザー入力査定する目的でも用意されています。詳細については、「標準コントロールセキュリティ保護」、「方法 : HTML エンコーディング文字列適用して Web アプリケーションスクリプトによる攻略から保護する」、および「ASP.NET Web ページにおけるユーザー入力検証」を参照してください

使用例使用例

テーブル作成しプログラムによって要素テーブル追加してから、テーブルWeb ページ表示する方法コード例次に示しますTableCell コントロール初期化される方法と、それらのプロパティ値が設定される方法注意してください

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page language="VB" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing"
 %>

<html>
    <head>
        <script runat="server">
            Private Sub Page_Load(sender As
 Object, e As System.EventArgs)
                ' Create a TableItemStyle object that can be
                ' set as the default style for all cells
                ' in the table.
                Dim tableStyle As New
 TableItemStyle()
                tableStyle.HorizontalAlign = HorizontalAlign.Center
                tableStyle.VerticalAlign = VerticalAlign.Middle
                tableStyle.Width = Unit.Pixel(100)
                ' Create more rows for the table.
                Dim i As Integer
                For i = 2 To 9
                    Dim tempRow As New
 TableRow()
                    Dim j As Integer
                    For j = 0 To 2
                        Dim tempCell As New
 TableCell()
                        tempCell.Text = "(" &
 i & "," & j & ")"
                        tempRow.Cells.Add(tempCell)
                    Next j
                    Table1.Rows.Add(tempRow)
                Next i

                ' Apply the TableItemStyle to all rows in the table.
                Dim r As TableRow
                For Each r In
  Table1.Rows
                    Dim c As TableCell
                    For Each c In
  r.Cells
                        c.ApplyStyle(tableStyle)
                    Next c 
                Next r

                ' Create a header for the table.
                Dim header As New
 TableHeaderCell()
                header.RowSpan = 1
                header.ColumnSpan = 3
                header.Text = "Table of (x,y) Values"
                header.Font.Bold = true
                header.BackColor = Color.Gray
                header.HorizontalAlign = HorizontalAlign.Center
                header.VerticalAlign = VerticalAlign.Middle

                ' Add the header to a new row.
                Dim headerRow As New
 TableRow()
                headerRow.Cells.Add(header)

                ' Add the header row to the table.
                Table1.Rows.AddAt(0, headerRow) 
            End Sub
        </script>
    </head>

    <body>
        <form runat="server">
            <h1>TableCell Example</h1>
            <asp:table id="Table1" runat="server"
 CellPadding="3" CellSpacing="3">
                <asp:TableRow>
                    <asp:TableCell Text="(0,0)"></asp:TableCell>
                    <asp:TableCell Text="(0,1)"></asp:TableCell>
                    <asp:TableCell Text="(0,2)"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Text="(1,0)"></asp:TableCell>
                    <asp:TableCell Text="(1,1)"></asp:TableCell>
                    <asp:TableCell Text="(1,2)"></asp:TableCell>
                </asp:TableRow>
            </asp:table>
        </form>
    </body>
</html>
<%@ Page language="C#" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing" %>

<html>
    <head>
        <script runat="server">
            private void Page_Load(object sender,
 System.EventArgs e)
            {
                // Create a TableItemStyle object that can be
                // set as the default style for all cells
                // in the table.
                TableItemStyle tableStyle = new TableItemStyle();
                tableStyle.HorizontalAlign = HorizontalAlign.Center;
                tableStyle.VerticalAlign = VerticalAlign.Middle;
                tableStyle.Width = Unit.Pixel(100);

                // Create more rows for the table.
                for (int i = 2; i < 10;
 i++)
                {
                    TableRow tempRow = new TableRow();
                    for (int j = 0; j <
 3; j++)
                    {
                        TableCell tempCell = new TableCell();
                        tempCell.Text = "(" + i + "," + j + ")";
                        tempRow.Cells.Add(tempCell);
                    }
                    Table1.Rows.Add(tempRow);
                }

                // Apply the TableItemStyle to all rows in the table.
                foreach (TableRow r in Table1.Rows)
                    foreach (TableCell c in
 r.Cells)
                        c.ApplyStyle(tableStyle);

                // Create a header for the table.
                TableHeaderCell header = new TableHeaderCell();
                header.RowSpan = 1;
                header.ColumnSpan = 3;
                header.Text = "Table of (x,y) Values";
                header.Font.Bold = true;
                header.BackColor = Color.Gray;
                header.HorizontalAlign = HorizontalAlign.Center;
                header.VerticalAlign = VerticalAlign.Middle;

                // Add the header to a new row.
                TableRow headerRow = new TableRow();
                headerRow.Cells.Add(header);

                // Add the header row to the table.
                Table1.Rows.AddAt(0, headerRow);  
            }
        </script>
    </head>

    <body>
        <form runat="server">
            <h1>TableCell Example</h1>
            <asp:table id="Table1" runat="server" CellPadding="3"
 CellSpacing="3">
                <asp:TableRow>
                    <asp:TableCell Text="(0,0)"></asp:TableCell>
                    <asp:TableCell Text="(0,1)"></asp:TableCell>
                    <asp:TableCell Text="(0,2)"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Text="(1,0)"></asp:TableCell>
                    <asp:TableCell Text="(1,1)"></asp:TableCell>
                    <asp:TableCell Text="(1,2)"></asp:TableCell>
                </asp:TableRow>
            </asp:table>
        </form>
    </body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.TableCell
         System.Web.UI.WebControls.DataControlFieldCell
         System.Web.UI.WebControls.TableHeaderCell
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TableCell クラス」の関連用語

TableCell クラスのお隣キーワード
検索ランキング

   

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



TableCell クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS