TemplateFieldとは? わかりやすく解説

TemplateField クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

データ バインド コントロールにカスタムの内容を表示するフィールドを表します。

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

Public Class TemplateField
    Inherits DataControlField
Dim instance As TemplateField
public class TemplateField : DataControlField
public ref class TemplateField : public
 DataControlField
public class TemplateField extends DataControlField
public class TemplateField extends
 DataControlField
解説解説

データ バインド コントロール (GridView、DetailsView など) はこの TemplateField クラスを使用して、表示される各レコードのカスタムの内容を表示します。いずれかの定義済みのデータ コントロール フィールド (BoundField など) で提供されないデータ バインド コントロールに内容を表示する場合は、TemplateField クラスを使用して、カスタム ユーザー インターフェイス (UI: User Interface) を作成します。TemplateField オブジェクトは、それが使用されているデータ バインド コントロールによって表示が異なります。たとえば、TemplateField オブジェクトは、GridView コントロールでは列として表示され、DetailsView コントロールでは行として表示されます。

次の表に示すテンプレートを使用して、TemplateField オブジェクトのさまざまな部分についてカスタム テンプレートを定義できます。

テンプレート

説明

AlternatingItemTemplate

TemplateField オブジェクトの交互の項目に表示する内容を指定します。

EditItemTemplate

TemplateField オブジェクトの編集モードの項目に表示する内容を指定します。

FooterTemplate

TemplateField オブジェクトのフッター セクションに表示する内容を指定します。

HeaderTemplate

TemplateField オブジェクトのヘッダー セクションに表示する内容を指定します。

InsertItemTemplate

TemplateField オブジェクトの挿入モードの項目に表示する内容を指定します。このテンプレートは、DetailsView コントロールだけでサポートされます。

ItemTemplate

TemplateField オブジェクトの項目に表示する内容を指定します。

データ バインド コントロール内の TemplateField オブジェクトを非表示にするには、Visible プロパティを false に設定します。

カスタムの HeaderTemplate テンプレートまたは FooterTemplate テンプレートを定義する代わりに、TemplateField オブジェクトの他のプロパティを設定して、TemplateField オブジェクトのヘッダー セクションとフッター セクションをカスタマイズできます。ヘッダー セクションにキャプションを表示するには、HeaderText プロパティを設定します。フッター セクションにキャプションを表示するには、FooterText プロパティを設定します。ヘッダー セクションにテキストを表示する代わりに、HeaderImageUrl プロパティを設定してイメージを表示できます。ShowHeader プロパティを false に設定することにより、TemplateField オブジェクトでヘッダー セクションを非表示にできます。

また、フィールドの各部分にスタイル プロパティを設定すると、TemplateField オブジェクトの外観 (フォントの色や背景色など) をカスタマイズできます。さまざまなスタイル プロパティの一覧を次の表に示します。

使用例使用例

2 つのフィールドを同じセルに表示するカスタムの TemplateField オブジェクトを作成するコード例を次に示します。最初の名前フィールドと最後の名前フィールドは、同じ TemplateField オブジェクトに結合されます。

<%@ Page language="VB" %>

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

      <!-- Populate the Columns collection declaratively. -->
      <!-- Create a custom TemplateField column that uses      -->
      <!-- two Label controls to display an author's
 first and -->
      <!-- last name in the same column.                  
     -->
      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="False"
        runat="server">
                
        <columns>
                
          <asp:templatefield headertext="Author Name">
            <itemtemplate>
              <asp:label id="FirstNameLabel"
                text= '<%# Eval("au_fname") %>'
                runat="server"/> 
              <asp:label id="LastNameLabel"
                text= '<%# Eval("au_lname") %>'
                runat="server"/>
            </itemtemplate>
          </asp:templatefield>
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects
 -->
      <!-- to the Pubs sample database.                   
     -->
      <asp:sqldatasource id="AuthorsSqlDataSource"
  
        selectcommand="SELECT [au_lname], [au_fname], [address],
 [city], [state], [zip], [contract] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated
 security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

<%@ Page language="C#" %>

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

      <!-- Populate the Columns collection declaratively. -->
      <!-- Create a custom TemplateField column that uses      -->
      <!-- two Label controls to display an author's first and -->
      <!-- last name in the same column.                  
     -->
      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="False"
        runat="server">
                
        <columns>
                
          <asp:templatefield headertext="Author Name">
            <itemtemplate>
              <asp:label id="FirstNameLabel"
                Text= '<%# Eval("au_fname") %>'
                runat="server"/> 
              <asp:label id="LastNameLabel"
                Text= '<%# Eval("au_lname") %>'
                runat="server"/>
            </itemtemplate>
          </asp:templatefield>
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects -->
      <!-- to the Pubs sample database.                        -->
      <asp:sqldatasource id="AuthorsSqlDataSource"  
        selectcommand="SELECT [au_lname], [au_fname], [address], [city], [state],
 [zip], [contract] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.WebControls.DataControlField
    System.Web.UI.WebControls.TemplateField
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TemplateField メンバ
System.Web.UI.WebControls 名前空間
GridView クラス
GridView.Columns プロパティ
DetailsView クラス
DetailsView.Fields プロパティ
BoundField クラス
ButtonField クラス
CheckBoxField クラス
CommandField クラス
DataControlField クラス
HyperLinkField クラス
AlternatingItemTemplate
EditItemTemplate
FooterTemplate
HeaderTemplate
InsertItemTemplate
ItemTemplate
DataControlField.Visible プロパティ

TemplateField コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

TemplateField クラスの新しいインスタンスを初期化します。

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

public TemplateField ()
public:
TemplateField ()
public TemplateField ()
public function TemplateField ()
解説解説
使用例使用例

コンストラクタを使用して、TemplateField フィールド列を GridView コントロールに動的に追加する方法を次のコード例に示します。

<%@ Page language="VB" %>

<script runat="server">
  
  ' Create a template class to represent a dynamic template column.
  Public Class GridViewTemplate   
    Implements ITemplate

    Private templateType As DataControlRowType
    Private columnName As String
   
    Sub New(ByVal type As
 DataControlRowType, ByVal colname As String)

      templateType = type
      columnName = colname
    
    End Sub

    Sub InstantiateIn(ByVal container As
 System.Web.UI.Control) _
      Implements ITemplate.InstantiateIn
      
      ' Create the content for the different row types.
      Select Case templateType

        Case DataControlRowType.Header
          ' Create the controls to put in the header
          ' section and set their properties.
          Dim lc As New
 Literal
          lc.Text = "<B>" & columnName &
 "</B>"
          
          ' Add the controls to the Controls collection
          ' of the container.
          container.Controls.Add(lc)

        Case DataControlRowType.DataRow
          ' Create the controls to put in a data row
          ' section and set their properties.
          Dim firstName As New
 Label
          Dim lastName As New
 Label
          
          Dim spacer = New Literal
          spacer.Text = " "
          
          ' To support data binding, register the event-handling methods
          ' to perform the data binding. Each control needs its own
 event
          ' handler.
          AddHandler firstName.DataBinding, AddressOf
 FirstName_DataBinding
          AddHandler lastName.DataBinding, AddressOf
 LastName_DataBinding
          
          ' Add the controls to the Controls collection
          ' of the container.
          container.Controls.Add(firstName)
          container.Controls.Add(spacer)
          container.Controls.Add(lastName)
          
          ' Insert cases to create the content for the other 
          ' row types, if desired.
          
        Case Else
        
          ' Insert code to handle unexpected values. 
          
      End Select
      
    End Sub
    
    Private Sub FirstName_DataBinding(ByVal
 sender As Object, ByVal
 e As EventArgs)

      ' Get the Label control to bind the value. The Label control
      ' is contained in the object that raised the DataBinding 
      ' event (the sender parameter).
      Dim l As Label = CType(sender, Label)
      
      ' Get the GridViewRow object that contains the Label control.
 
      Dim row As GridViewRow = CType(l.NamingContainer,
 GridViewRow)
      
      ' Get the field value from the GridViewRow object and 
      ' assign it to the Text property of the Label control.
      l.Text = DataBinder.Eval(row.DataItem, "au_fname").ToString()
    
    End Sub
    
    Private Sub LastName_DataBinding(ByVal
 sender As Object, ByVal
 e As EventArgs)
 
      ' Get the Label control to bind the value. The Label control
      ' is contained in the object that raised the DataBinding 
      ' event (the sender parameter).
      Dim l As Label = CType(sender, Label)
      
      ' Get the GridViewRow object that contains the Label control.
      Dim row As GridViewRow = CType(l.NamingContainer,
 GridViewRow)
      
      ' Get the field value from the GridViewRow object and 
      ' assign it to the Text property of the Label control.
      l.Text = DataBinder.Eval(row.DataItem, "au_lname").ToString()
    
    End Sub
    
  End Class

  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
    
    ' The field columns need to be created only when the page is
    ' first loaded. 
    If Not IsPostBack Then
      ' Dynamically create field columns to display the desired
      ' fields from the data source. Create a TemplateField object 
      ' to display an author's first and last name.
      Dim customField As New
 TemplateField

      ' Create the dynamic templates and assign them to
      ' the appropriate template property.
      customField.ItemTemplate = New GridViewTemplate(DataControlRowType.DataRow,
 "Author Name")
      customField.HeaderTemplate = New GridViewTemplate(DataControlRowType.Header,
 "Author Name")

      ' Add the field column to the Columns collection of the
      ' GridView control.
      AuthorsGridView.Columns.Add(customField)
    End If
  
  End Sub

</script>

<html>
  <body>
    <form runat="server">
        
      <h3>TemplateField Constructor Example</h3>

      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="False"
        runat="server">                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects
 -->
      <!-- to the Pubs sample database.                   
     -->
      <asp:sqldatasource id="AuthorsSqlDataSource"
  
        selectcommand="SELECT [au_fname], [au_lname] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated
 security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

<%@ Page language="C#" %>

<script runat="server">
  
  // Create a template class to represent a dynamic template column.
  public class GridViewTemplate : ITemplate
  {
    private DataControlRowType templateType;
    private string columnName;
   
    public GridViewTemplate(DataControlRowType type, string
 colname)
    {
      templateType = type;
      columnName = colname;
    }

    public void InstantiateIn(System.Web.UI.Control
 container)
    {
      // Create the content for the different row types.
      switch(templateType)
      {
        case DataControlRowType.Header:
          // Create the controls to put in the header
          // section and set their properties.
          Literal lc = new Literal();
          lc.Text = "<B>" + columnName + "</B>";
          
          // Add the controls to the Controls collection
          // of the container.
          container.Controls.Add(lc);
          break;
        case DataControlRowType.DataRow:
          // Create the controls to put in a data row
          // section and set their properties.
          Label firstName = new Label();
          Label lastName = new Label();
          
          Literal spacer = new Literal();
          spacer.Text = " ";
          
          // To support data binding, register the event-handling methods
          // to perform the data binding. Each control needs its own
 event
          // handler.
          firstName.DataBinding += new EventHandler(this.FirstName_DataBinding);
          lastName.DataBinding += new EventHandler(this.LastName_DataBinding);
          
          // Add the controls to the Controls collection
          // of the container.
          container.Controls.Add(firstName);
          container.Controls.Add (spacer);
          container.Controls.Add(lastName);
          break;
          
        // Insert cases to create the content for the other 
        // row types, if desired.
          
        default:
          // Insert code to handle unexpected values.
          break; 
      }
    }
    
    private void FirstName_DataBinding(Object
 sender, EventArgs e)
    {
      // Get the Label control to bind the value. The Label control
      // is contained in the object that raised the DataBinding 
      // event (the sender parameter).
      Label l = (Label)sender;
      
      // Get the GridViewRow object that contains the Label control.
 
      GridViewRow row = (GridViewRow)l.NamingContainer;
      
      // Get the field value from the GridViewRow object and 
      // assign it to the Text property of the Label control.
      l.Text = DataBinder.Eval(row.DataItem, "au_fname").ToString();
    }
    
    private void LastName_DataBinding(Object
 sender, EventArgs e)
    { 
      // Get the Label control to bind the value. The Label control
      // is contained in the object that raised the DataBinding 
      // event (the sender parameter).
      Label l = (Label)sender;
      
      // Get the GridViewRow object that contains the Label control.
      GridViewRow row = (GridViewRow)l.NamingContainer;
      
      // Get the field value from the GridViewRow object and 
      // assign it to the Text property of the Label control.
      l.Text = DataBinder.Eval(row.DataItem, "au_lname").ToString();
    }
  }

  void Page_Load(Object sender, EventArgs e)
  {
    
    // The field columns need to be created only when the page is
    // first loaded. 
    if (!IsPostBack)
    {
      // Dynamically create field columns to display the desired
      // fields from the data source. Create a TemplateField object
 
      // to display an author's first and last name.
      TemplateField customField = new TemplateField();

      // Create the dynamic templates and assign them to 
      // the appropriate template property.
      customField.ItemTemplate = new GridViewTemplate(DataControlRowType.DataRow,
 "Author Name");
      customField.HeaderTemplate = new GridViewTemplate(DataControlRowType.Header,
 "Author Name");

      // Add the field column to the Columns collection of the
      // GridView control.
      AuthorsGridView.Columns.Add(customField);
    }
  
  }

</script>

<html>
  <body>
    <form runat="server">
        
      <h3>TemplateField Constructor Example</h3>

      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="False"
        runat="server">                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects -->
      <!-- to the Pubs sample database.                        -->
      <asp:sqldatasource id="AuthorsSqlDataSource"  
        selectcommand="SELECT [au_fname], [au_lname] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TemplateField クラス
TemplateField メンバ
System.Web.UI.WebControls 名前空間
GridView クラス
GridView.Columns プロパティ
DetailsView クラス
DetailsView.Fields プロパティ

TemplateField プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ AccessibleHeaderText  一部のコントロールの AbbreviatedText プロパティ値として表示されるテキストを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ AlternatingItemTemplate TemplateField オブジェクトの交互の項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ ControlStyle  DataControlField オブジェクトに格納されているすべての Web サーバー コントロールのスタイルを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ ConvertEmptyStringToNull TemplateField オブジェクトをバインドする値が Empty である場合にこの値を null 参照 (Visual Basic では Nothing) に変換するかどうかを示す値を取得または設定します。
パブリック プロパティ EditItemTemplate TemplateField オブジェクトの編集モードの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ FooterStyle  データ コントロール フィールドのフッターのスタイルを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ FooterTemplate TemplateField オブジェクトのフッター セクションを表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ FooterText  データ コントロール フィールドのフッター項目に表示されるテキストを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ HeaderImageUrl  データ コントロール フィールドのヘッダー項目に表示されるイメージの URL を取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ HeaderStyle  データ コントロール フィールドのヘッダーのスタイルを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ HeaderTemplate TemplateField オブジェクトのヘッダー セクションを表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ HeaderText  データ コントロール フィールドのヘッダー項目に表示されるテキストを取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ InsertItemTemplate TemplateField オブジェクトの挿入モードの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ InsertVisible  DataControlField オブジェクトの親データ バインド コントロールが挿入モードの場合に、このオブジェクトが表示されるかどうかを示す値を取得します。 ( DataControlField から継承されます。)
パブリック プロパティ ItemStyle  データ コントロール フィールドで表示されるテキスト ベースの内容のスタイルを取得します。 ( DataControlField から継承されます。)
パブリック プロパティ ItemTemplate データ バインド コントロールの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ ShowHeader  データ コントロール フィールドのヘッダー項目を表示するかどうかを示す値を取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ SortExpression  データ ソース コントロールでデータを並べ替えるために使用される並べ替え式を、取得または設定します。 ( DataControlField から継承されます。)
パブリック プロパティ Visible  データ コントロール フィールドを表示するかどうかを示す値を取得または設定します。 ( DataControlField から継承されます。)
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ Control  DataControlField オブジェクトが関連付けられているデータ コントロールの参照を取得します。 ( DataControlField から継承されます。)
プロテクト プロパティ DesignMode  デザイン時環境で、現在データ コントロール フィールドが表示されているかどうかを示す値を取得します。 ( DataControlField から継承されます。)
プロテクト プロパティ IsTrackingViewState  DataControlField オブジェクトがビューステートへの変更を保存しているかどうかを示す値を取得します。 ( DataControlField から継承されます。)
プロテクト プロパティ ViewState  同一のページに対する複数の要求にわたって、DataControlField オブジェクトのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。 ( DataControlField から継承されます。)
参照参照

関連項目

TemplateField クラス
System.Web.UI.WebControls 名前空間
GridView クラス
GridView.Columns プロパティ
DetailsView クラス
DetailsView.Fields プロパティ
BoundField クラス
ButtonField クラス
CheckBoxField クラス
CommandField クラス
DataControlField クラス
HyperLinkField クラス
AlternatingItemTemplate
EditItemTemplate
FooterTemplate
HeaderTemplate
InsertItemTemplate
ItemTemplate
DataControlField.Visible プロパティ

TemplateField メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ExtractValuesFromCell オーバーライドされます。 1 つ以上の双方向のバインディング ステートメント (DataBind) で指定されたとおりに、現在のテーブル セルからデータ コントロール フィールドの値を抽出して、指定された IOrderedDictionary コレクションに値を追加します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド Initialize  データ コントロール フィールドのインスタンスの基本的な初期化を実行します。 ( DataControlField から継承されます。)
パブリック メソッド InitializeCell オーバーライドされます。 セルのコントロールのコレクションにテキストまたはコントロールを追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  この DataControlField オブジェクトを表す文字列を返します。 ( DataControlField から継承されます。)
パブリック メソッド ValidateSupportsCallback オーバーライドされます。 TemplateField オブジェクトに格納されているコントロールがページのコールバックをサポートしているかどうかを確認します。
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド CloneField  現在の DataControlField 派生オブジェクトのコピーを作成します。 ( DataControlField から継承されます。)
プロテクト メソッド CopyProperties オーバーライドされます。 現在の TemplateField 派生オブジェクトのプロパティを、指定された DataControlField オブジェクトにコピーします。
プロテクト メソッド CreateField オーバーライドされます。 新しい TemplateField オブジェクトを作成します。
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。)
プロテクト メソッド LoadViewState  データ ソース ビューの、以前保存したビューステートを復元します。 ( DataControlField から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 ( Object から継承されます。)
プロテクト メソッド OnFieldChanged  FieldChanged イベントを発生させます。 ( DataControlField から継承されます。)
プロテクト メソッド SaveViewState  ページがサーバーにポストバックされた時間以降に発生した、DataControlField ビューステートへの変更を保存します。 ( DataControlField から継承されます。)
プロテクト メソッド TrackViewState  DataControlField オブジェクトがそのビューステートの変更を追跡するようにします。それにより、変更をコントロールの ViewState プロパティに格納して、同じページに対する複数の要求にわたって永続化できます。 ( DataControlField から継承されます。)
参照参照

関連項目

TemplateField クラス
System.Web.UI.WebControls 名前空間
GridView クラス
GridView.Columns プロパティ
DetailsView クラス
DetailsView.Fields プロパティ
BoundField クラス
ButtonField クラス
CheckBoxField クラス
CommandField クラス
DataControlField クラス
HyperLinkField クラス
AlternatingItemTemplate
EditItemTemplate
FooterTemplate
HeaderTemplate
InsertItemTemplate
ItemTemplate
DataControlField.Visible プロパティ

TemplateField メンバ

データ バインド コントロールにカスタムの内容を表示するフィールドを表します。

TemplateField データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド TemplateField TemplateField クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ AccessibleHeaderText  一部のコントロールの AbbreviatedText プロパティ値として表示されるテキストを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ AlternatingItemTemplate TemplateField オブジェクトの交互の項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ ControlStyle  DataControlField オブジェクトに格納されているすべての Web サーバー コントロールのスタイルを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ ConvertEmptyStringToNull TemplateField オブジェクトをバインドする値が Empty である場合にこの値を null 参照 (Visual Basic では Nothing) に変換するかどうかを示す値を取得または設定します。
パブリック プロパティ EditItemTemplate TemplateField オブジェクトの編集モードの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ FooterStyle  データ コントロール フィールドのフッターのスタイルを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ FooterTemplate TemplateField オブジェクトのフッター セクションを表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ FooterText  データ コントロール フィールドのフッター項目に表示されるテキストを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ HeaderImageUrl  データ コントロール フィールドのヘッダー項目に表示されるイメージの URL を取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ HeaderStyle  データ コントロール フィールドのヘッダーのスタイルを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ HeaderTemplate TemplateField オブジェクトのヘッダー セクションを表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ HeaderText  データ コントロール フィールドのヘッダー項目に表示されるテキストを取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ InsertItemTemplate TemplateField オブジェクトの挿入モードの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ InsertVisible  DataControlField オブジェクトの親データ バインド コントロールが挿入モードの場合に、このオブジェクトが表示されるかどうかを示す値を取得します。(DataControlField から継承されます。)
パブリック プロパティ ItemStyle  データ コントロール フィールドで表示されるテキスト ベースの内容のスタイルを取得します。(DataControlField から継承されます。)
パブリック プロパティ ItemTemplate データ バインド コントロールの項目を表示するときに使用するテンプレートを取得または設定します。
パブリック プロパティ ShowHeader  データ コントロール フィールドのヘッダー項目を表示するかどうかを示す値を取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ SortExpression  データ ソース コントロールでデータを並べ替えるために使用される並べ替え式を、取得または設定します。(DataControlField から継承されます。)
パブリック プロパティ Visible  データ コントロール フィールドを表示するかどうかを示す値を取得または設定します。(DataControlField から継承されます。)
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ Control  DataControlField オブジェクトが関連付けられているデータ コントロールの参照を取得します。(DataControlField から継承されます。)
プロテクト プロパティ DesignMode  デザイン時環境で、現在データ コントロール フィールドが表示されているかどうかを示す値を取得します。(DataControlField から継承されます。)
プロテクト プロパティ IsTrackingViewState  DataControlField オブジェクトがビューステートへの変更を保存しているかどうかを示す値を取得します。(DataControlField から継承されます。)
プロテクト プロパティ ViewState  同一のページに対する複数の要求にわたって、DataControlField オブジェクトのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。(DataControlField から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド ExtractValuesFromCell オーバーライドされます。 1 つ以上の双方向のバインディング ステートメント (DataBind) で指定されたとおりに、現在のテーブル セルからデータ コントロール フィールドの値を抽出して、指定された IOrderedDictionary コレクションに値を追加します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド Initialize  データ コントロール フィールドのインスタンスの基本的な初期化を実行します。 (DataControlField から継承されます。)
パブリック メソッド InitializeCell オーバーライドされます。 セルのコントロールのコレクションにテキストまたはコントロールを追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  この DataControlField オブジェクトを表す文字列を返します。 (DataControlField から継承されます。)
パブリック メソッド ValidateSupportsCallback オーバーライドされます。 TemplateField オブジェクトに格納されているコントロールがページのコールバックをサポートしているかどうかを確認します。
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド CloneField  現在の DataControlField 派生オブジェクトのコピーを作成します。 (DataControlField から継承されます。)
プロテクト メソッド CopyProperties オーバーライドされます。 現在の TemplateField 派生オブジェクトのプロパティを、指定された DataControlField オブジェクトにコピーします。
プロテクト メソッド CreateField オーバーライドされます。 新しい TemplateField オブジェクトを作成します。
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
プロテクト メソッド LoadViewState  データ ソース ビューの、以前保存したビューステートを復元します。 (DataControlField から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 (Object から継承されます。)
プロテクト メソッド OnFieldChanged  FieldChanged イベントを発生させます。 (DataControlField から継承されます。)
プロテクト メソッド SaveViewState  ページがサーバーにポストバックされた時間以降に発生した、DataControlField ビューステートへの変更を保存します。 (DataControlField から継承されます。)
プロテクト メソッド TrackViewState  DataControlField オブジェクトがそのビューステートの変更を追跡するようにします。それにより、変更をコントロールの ViewState プロパティに格納して、同じページに対する複数の要求にわたって永続化できます。 (DataControlField から継承されます。)
参照参照

関連項目

TemplateField クラス
System.Web.UI.WebControls 名前空間
GridView クラス
GridView.Columns プロパティ
DetailsView クラス
DetailsView.Fields プロパティ
BoundField クラス
ButtonField クラス
CheckBoxField クラス
CommandField クラス
DataControlField クラス
HyperLinkField クラス
AlternatingItemTemplate
EditItemTemplate
FooterTemplate
HeaderTemplate
InsertItemTemplate
ItemTemplate
DataControlField.Visible プロパティ



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「TemplateField」の関連用語

TemplateFieldのお隣キーワード
検索ランキング

   

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



TemplateFieldのページの著作権

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

©2026 GRAS Group, Inc.RSS