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

DataControlField クラス

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

DetailsView、GridView など、表形式のデータ バインド コントロールのデータ列を表すすべての種類のデータ コントロール フィールドの基本クラスとして機能します。

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

Public MustInherit Class
 DataControlField
    Implements IStateManager, IDataSourceViewSchemaAccessor
Dim instance As DataControlField
public abstract class DataControlField : IStateManager,
 IDataSourceViewSchemaAccessor
public ref class DataControlField abstract
 : IStateManager, IDataSourceViewSchemaAccessor
public abstract class DataControlField implements
 IStateManager, IDataSourceViewSchemaAccessor
public abstract class DataControlField implements
 IStateManager, IDataSourceViewSchemaAccessor
解説解説

DataControlField クラスは、すべての種類のデータ コントロール フィールドの基本クラスとして機能します。データ コントロール フィールドは、DataGridColumn オブジェクトが DataGrid コントロールの列の種類を表すのと同様に、データ バインド コントロールでデータのフィールドを表すために使用されます。

DataControlField から派生したクラスを使用して、DetailsView や GridView などのデータ バインド コントロールでのデータ フィールドの表示方法を制御します。ASP.NET で提供される各種のデータ コントロール フィールドを次の表に示します。

DataControlField クラスと BoundField クラスを拡張して、独自の種類のデータ コントロール フィールドを作成することもできます。

DataControlField クラスには、ユーザー インターフェイス (UI: User Interface) の要素をデータ バインド コントロールに表示する方法を制御する多数のプロパティが用意されています。UI を表示するときにデータ コントロール フィールドの使用可能なプロパティを使用しないコントロールもあります。たとえば、データ コントロール フィールドを行として表示する DetailsView コントロールには、各データ コントロール フィールドのヘッダー項目は含まれますが、フッター項目は含まれません。そのため、DetailsView コントロールでは FooterText プロパティと FooterStyle プロパティが無視されます。ただし、ShowFooter プロパティを true に設定すると、GridView コントロールは FooterText プロパティと FooterStyle プロパティを使用します。同様に、UI 要素によっては、その表示形式がデータ コントロール フィールドのプロパティの影響を受けます。ItemStyle プロパティは、必ずそのフィールドに適用されます。ButtonField クラスや CheckBoxField クラスのように、DataControlField から派生した型にコントロールが含まれる場合、ControlStyle プロパティがこのフィールドに適用されます。

使用例使用例

DataControlField から派生する BoundField オブジェクトと ButtonField オブジェクトを使用して、DetailsView コントロールに行を表示する方法を次のコード例に示します。DetailsView コントロールの AutoGenerateRows プロパティは false に設定されており、SelectCommand プロパティから返されたデータのサブセットを表示できます。

<%@ page language="VB" %>
<html>
<body>
  <form runat="server">

    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
      selectcommand="Select * From Employees">
    </asp:sqldatasource>

    <asp:detailsview
      id="DetailsView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      height="208px"
      width="264px"
      autogeneraterows="False">
        <fields>

          <asp:boundfield
            sortexpression="LastName"
            datafield="LastName"
            headertext="LastName">
              <itemstyle backcolor="Yellow">
              </itemstyle>
          </asp:boundfield>

          <asp:boundfield
            sortexpression="FirstName"
            datafield="FirstName"
            headertext="FirstName">
              <itemstyle forecolor="#C00000">
              </itemstyle>
          </asp:boundfield>

          <asp:buttonfield
            text="TestButton"
            buttontype="Button">
          </asp:buttonfield>

        </fields>
    </asp:detailsview>

  </form>
</body>
</html>
<%@ page language="C#" %>
<html>
<body>
  <form runat="server">

    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
      selectcommand="Select * From Employees">
    </asp:sqldatasource>

    <asp:detailsview
      id="DetailsView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      height="208px"
      width="264px"
      autogeneraterows="False">
        <fields>

          <asp:boundfield
            sortexpression="LastName"
            datafield="LastName"
            headertext="LastName">
              <itemstyle backcolor="Yellow">
              </itemstyle>
          </asp:boundfield>

          <asp:boundfield
            sortexpression="FirstName"
            datafield="FirstName"
            headertext="FirstName">
              <itemstyle forecolor="#C00000">
              </itemstyle>
          </asp:boundfield>

          <asp:buttonfield
            text="TestButton"
            buttontype="Button">
          </asp:buttonfield>

        </fields>
    </asp:detailsview>

  </form>
</body>
</html>
<%@ page language="VJ#" %>
<html>
<body>
  <form runat="server">

    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial
 Catalog=Northwind;"
      selectcommand="Select * From Employees">
    </asp:sqldatasource>

    <asp:detailsview
      id="DetailsView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      height="208px"
      width="264px"
      autogeneraterows="False">
        <fields>

          <asp:boundfield
            sortexpression="LastName"
            datafield="LastName"
            headertext="LastName">
              <itemstyle backcolor="Yellow">
              </itemstyle>
          </asp:boundfield>

          <asp:boundfield
            sortexpression="FirstName"
            datafield="FirstName"
            headertext="FirstName">
              <itemstyle forecolor="#C00000">
              </itemstyle>
          </asp:boundfield>

          <asp:buttonfield
            text="TestButton"
            buttontype="Button">
          </asp:buttonfield>

        </fields>
    </asp:detailsview>

  </form>
</body>
</html>

BoundField クラスを拡張して、GridView コントロールで使用できるカスタム バインド フィールドを作成する方法を次のコード例に示します。CheckBoxField クラスと同様に、RadioButtonField クラスは true または false のデータ列を表示します。CheckBoxField クラスがバインドされるデータは true 値または false 値の任意のセットでかまいませんが、RadioButtonField クラスがバインドされるデータのセットに含まれる true 値は必ず 1 つだけである必要があります。この例では、DataControlField から派生したすべてのクラスの 2 つの重要なメソッドである ExtractValuesFromCell メソッドと InitializeCell メソッドの実装方法を示しています。

Imports System
Imports System.Collections.Specialized
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Samples.AspNet.VB

    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public NotInheritable Class
 RadioButtonField
        Inherits CheckBoxField

        Public Sub New()
        End Sub 'New

        ' Gets a default value for a basic design-time experience. Since
        ' it would look odd, even at design time, to have more than
 one
        ' radio button selected, make sure that none are selected.
        Protected Overrides Function
 GetDesignTimeValue() As Object
            Return False
        End Function

        ' This method is called by the ExtractRowValues methods of
        ' GridView and DetailsView. Retrieve the current value of the
 
        ' cell from the Checked state of the Radio button.
        Public Overrides Sub
 ExtractValuesFromCell( _
            ByVal dictionary As IOrderedDictionary,
 _
            ByVal cell As DataControlFieldCell,
 _
            ByVal rowState As DataControlRowState,
 _
            ByVal includeReadOnly As Boolean)
            ' Determine whether the cell contain a RadioButton 
            ' in its Controls collection.
            If cell.Controls.Count > 0 Then
                Dim radio As RadioButton =
 CType(cell.Controls(0), RadioButton)

                Dim checkedValue As Object
 = Nothing
                If radio Is Nothing
 Then
                    ' A RadioButton is expected, but a null is encountered.
                    ' Add error handling.
                    Throw New InvalidOperationException(
 _
                        "RadioButtonField could not extract control.")
                Else
                    checkedValue = radio.Checked
                End If


                ' Add the value of the Checked attribute of the
                ' RadioButton to the dictionary.
                If dictionary.Contains(DataField) Then
                    dictionary(DataField) = checkedValue
                Else
                    dictionary.Add(DataField, checkedValue)
                End If
            End If
        End Sub
        ' This method adds a RadioButton control and any other 
        ' content to the cell's Controls collection.
        Protected Overrides Sub
 InitializeDataCell( _
            ByVal cell As DataControlFieldCell,
 _
            ByVal rowState As DataControlRowState)

            Dim radio As New
 RadioButton()

            ' If the RadioButton is bound to a DataField, add
            ' the OnDataBindingField method event handler to the
            ' DataBinding event.
            If DataField.Length <> 0 Then
                AddHandler radio.DataBinding, AddressOf
 Me.OnDataBindField
            End If

            radio.Text = Me.Text

            ' Because the RadioButtonField is a BoundField, it only
 
            ' displays data. Therefore, unless the row is in edit mode,
 
            ' the RadioButton is displayed as disabled.
            radio.Enabled = False
            ' If the row is in edit mode, enable the button.
            If (rowState And DataControlRowState.Edit)
 <> 0 _
                OrElse (rowState And DataControlRowState.Insert)
 <> 0 Then
                radio.Enabled = True
            End If

            cell.Controls.Add(radio)
        End Sub

    End Class

End Namespace
namespace Samples.AspNet.CS {

  using System;
  using System.Collections;
  using System.Collections.Specialized;
  using System.ComponentModel;
  using System.Security.Permissions;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;

  [AspNetHostingPermission(SecurityAction.Demand, 
      Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class RadioButtonField : CheckBoxField
 {

    public RadioButtonField() {
    }

    // Gets a default value for a basic design-time experience. 
    // Since it would look odd, even at design time, to have 
    // more than one radio button selected, make sure that none
    // are selected.
    protected override object GetDesignTimeValue() {
        return false;
    }
    // This method is called by the ExtractRowValues methods of 
    // GridView and DetailsView. Retrieve the current value of the 
    // cell from the Checked state of the Radio button.
    public override void ExtractValuesFromCell(IOrderedDictionary
 dictionary,
                                               DataControlFieldCell cell,
                                               DataControlRowState rowState,
                                               bool includeReadOnly)
    {

      // Determine whether the cell contains a RadioButton 
      // in its Controls collection.
      if (cell.Controls.Count > 0) {
        RadioButton radio = cell.Controls[0] as RadioButton;

        object checkedValue = null;
        if (null == radio) {
          // A RadioButton is expected, but a null is encountered.
          // Add error handling.
          throw new InvalidOperationException
              ("RadioButtonField could not extract control.");
        }
        else {
            checkedValue = radio.Checked;
        }


        // Add the value of the Checked attribute of the
        // RadioButton to the dictionary.
        if (dictionary.Contains(DataField))
          dictionary[DataField] = checkedValue;
        else
          dictionary.Add(DataField, checkedValue);
      }
    }
    // This method adds a RadioButton control and any other 
    // content to the cell's Controls collection.
    protected override void InitializeDataCell
        (DataControlFieldCell cell, DataControlRowState rowState) {

      RadioButton radio = new RadioButton();

      // If the RadioButton is bound to a DataField, add
      // the OnDataBindingField method event handler to the
      // DataBinding event.
      if (DataField.Length != 0) {
        radio.DataBinding += new EventHandler(this.OnDataBindField);
      }

      radio.Text = this.Text;

      // Because the RadioButtonField is a BoundField, it only
      // displays data. Therefore, unless the row is in edit mode,
      // the RadioButton is displayed as disabled.
      radio.Enabled = false;
      // If the row is in edit mode, enable the button.
      if ((rowState & DataControlRowState.Edit) != 0 ||
          (rowState & DataControlRowState.Insert) != 0) {
        radio.Enabled = true;
      }

      cell.Controls.Add(radio);
    }
  }
}
package Samples.AspNet; 

import System.*;
import System.Collections.*;
import System.Collections.Specialized.*;
import System.ComponentModel.*;
import System.Web.UI.*;
import System.Web.UI.WebControls.*;

public class RadioButtonField extends CheckBoxField
{    
    public RadioButtonField()
    {
    } //RadioButtonField

    // Gets a default value for a basic design-time experience. 
    //Since it would look odd,
    // even at design time, to have more than one radio button selected
,
    //make sure that
    // none are selected.
    protected Object GetDesignTimeValue()
    {
        return (System.Boolean)false;
    } //GetDesignTimeValue

    // This method is called by the ExtractRowValues methods on GridView
 
    //and DetailsView. Retrieve
    // the current value of the cell from the Checked state of the Radio
 button.
    public void ExtractValuesFromCell(IOrderedDictionary
 dictionary, 
        DataControlFieldCell cell, DataControlRowState rowState, 
        boolean includeReadOnly) throws InvalidOperationException
    {
        // Does the cell contain a RadioButton in its Controls collection?
        if (cell.get_Controls().get_Count() > 0) {
            RadioButton radio = (RadioButton)cell.get_Controls().get_Item(0);

            Object checkedValue = null;
            if (null == radio) {
                // A RadioButton is expected,
                // but a null is encountered. Add error handling.
                throw new InvalidOperationException("RadioButtonField
 could not"
                    + "extract control.");
            }
            else {
                checkedValue = (System.Boolean)radio.get_Checked();
            }
            // Add the value of the Checked attribute of the
            // RadioButton to the dictionary.
            if (dictionary.Contains(get_DataField())) {
                dictionary.set_Item(get_DataField(), checkedValue);
            }
            else {
                dictionary.Add(get_DataField(), checkedValue);
            }
        }
    } //ExtractValuesFromCell

    // This method adds a RadioButton control and any other content
 to the
    //cell's Controls collection.
    protected void InitializeDataCell(DataControlFieldCell
 cell, 
        DataControlRowState rowState)
    {
        RadioButton radio = new RadioButton();
        // If the RadioButton is bound to a DataField, add
        // the OnDataBindingField method event handler to the
        // DataBinding event.
        if (get_DataField().get_Length() != 0) {
            radio.add_DataBinding(new EventHandler(this.OnDataBindField));
        }
        radio.set_Text(this.get_Text());
        // Because the RadioButtonField is a BoundField, it only displays
 data. Therefore,
        // unless the row is in edit mode, the RadioButton is displayed
 as 
        // disabled.
        radio.set_Enabled(false);
        // If the row is in edit mode, enable the button.
        if (((int)(rowState & DataControlRowState.Edit)
 != 0) || ((int)(
            rowState & DataControlRowState.Insert) != 0)) {
            radio.set_Enabled(true);
        }
        cell.get_Controls().Add(radio);
    } //InitializeDataCell
} //RadioButtonField    

前の例で使用した RadioButtonField クラスを GridView コントロールで使用する方法を次のコード例に示します。この例では、GridView コントロールにスポーツ チームのデータを表示します。選手のデータは、ID 列、選手名の列、およびチームのキャプテンを true または false で示す列を含むデータ テーブルで管理されます。また、RadioButtonField クラスを使用して、現在のチーム キャプテンであるチーム メンバーを表示します。GridView コントロールを編集して、新しいチーム キャプテンを選択したり、他の選手情報を変更したりできます。

<%@ page language="VB" %>
<%@ Register Tagprefix="aspSample"
             Namespace="Samples.AspNet.VB"
             Assembly="Samples.AspNet.VB"
 %>

<html>
<body>
    <form runat="server">

        <asp:gridview
          id="GridView1"
          runat="server"
          allowpaging="True"
          datasourceid="SqlDataSource1"
          allowsorting="True"
          autogeneratecolumns="False"
          autogenerateeditbutton="True"
          datakeynames="AnID">
            <columns>
                <aspSample:radiobuttonfield
                  headertext="RadioButtonField"
                  text="TeamLeader"
                  datafield="TrueFalse">
                </aspSample:radiobuttonfield>

                <asp:boundfield
                  insertvisible="False"
                  sortexpression="AnID"
                  datafield="AnID"
                  readonly="True"
                  headertext="AnID">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="FirstName"
                  datafield="FirstName"
                  headertext="FirstName">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="LastName"
                  datafield="LastName"
                  headertext="LastName">
                </asp:boundfield>

              </columns>
        </asp:gridview>
        <asp:sqldatasource
          id="SqlDataSource1"
          runat="server"
          connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
          selectcommand="SELECT AnID,FirstName,LastName,TeamLeader
 FROM Players"
          updatecommand="UPDATE Players SET TrueFalse='false';UPDATE
 Players SET TrueFalse='true' WHERE AnID=@anID">
        </asp:sqldatasource>

    </form>
</body>
</html>
<%@ page language="C#" %>
<%@ Register Tagprefix="aspSample"
             Namespace="Samples.AspNet.CS"
             Assembly="Samples.AspNet.CS" %>

<html>
<body>
    <form runat="server">
        <asp:gridview
          id="GridView1"
          runat="server"
          allowpaging="True"
          datasourceid="SqlDataSource1"
          allowsorting="True"
          autogeneratecolumns="False"
          autogenerateeditbutton="True"
          datakeynames="AnID">
            <columns>

                <aspSample:radiobuttonfield
                  headertext="RadioButtonField"
                  text="TeamLeader"
                  datafield="TrueFalse">
                </aspSample:radiobuttonfield>

                <asp:boundfield
                  insertvisible="False"
                  sortexpression="AnID"
                  datafield="AnID"
                  readonly="True"
                  headertext="AnID">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="FirstName"
                  datafield="FirstName"
                  headertext="FirstName">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="LastName"
                  datafield="LastName"
                  headertext="LastName">
                </asp:boundfield>

              </columns>
        </asp:gridview>
        <asp:sqldatasource
          id="SqlDataSource1"
          runat="server"
          connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
          selectcommand="SELECT AnID,FirstName,LastName,TeamLeader FROM Players"
          updatecommand="UPDATE Players SET TrueFalse='false';UPDATE
 Players SET TrueFalse='true' WHERE AnID=@anID">
        </asp:sqldatasource>

    </form>
</body>
</html>
<%@ page language="VJ#" %>
<%@ Register Tagprefix="aspSample"
             Namespace="Samples.AspNet"
             Assembly="Samples.AspNet.JSL" %>

<html>
<body>
    <form runat="server">
        <asp:gridview
          id="GridView1"
          runat="server"
          allowpaging="True"
          datasourceid="SqlDataSource1"
          allowsorting="True"
          autogeneratecolumns="False"
          autogenerateeditbutton="True"
          datakeynames="AnID">
            <columns>

                <aspSample:radiobuttonfield
                  headertext="RadioButtonField"
                  text="TeamLeader"
                  datafield="TrueFalse">
                </aspSample:radiobuttonfield>

                <asp:boundfield
                  insertvisible="False"
                  sortexpression="AnID"
                  datafield="AnID"
                  readonly="True"
                  headertext="AnID">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="FirstName"
                  datafield="FirstName"
                  headertext="FirstName">
                </asp:boundfield>

                <asp:boundfield
                  sortexpression="LastName"
                  datafield="LastName"
                  headertext="LastName">
                </asp:boundfield>

              </columns>
        </asp:gridview>
        <asp:sqldatasource
          id="SqlDataSource1"
          runat="server"
          Connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial
 Catalog=Northwind"
          SelectCommand="SELECT AnID,FirstName,LastName,TeamLeader FROM Players"
          UpdateCommand="UPDATE Players SET TrueFalse='false';UPDATE
 Players SET TrueFalse='true' WHERE AnID=@anID">
        </asp:sqldatasource>

    </form>
</body>
</html>
継承階層継承階層
System.Object
  System.Web.UI.WebControls.DataControlField
     System.Web.UI.WebControls.BoundField
     System.Web.UI.WebControls.ButtonFieldBase
     System.Web.UI.WebControls.HyperLinkField
     System.Web.UI.WebControls.ImageField
     System.Web.UI.WebControls.TemplateField
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataControlField メンバ
System.Web.UI.WebControls 名前空間
BoundField クラス
ButtonFieldBase クラス
CheckBoxField クラス
CommandField クラス
HyperLinkField
ImageField
TemplateField

DataControlField コンストラクタ

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

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

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

Dim instance As New DataControlField
protected DataControlField ()
protected:
DataControlField ()
protected DataControlField ()
protected function DataControlField ()
解説解説

DataControlField クラスは抽象クラスなので、DataControlField オブジェクトを直接作成することはできません。通常、このコンストラクタは、派生クラスのコンストラクタで呼び出されて、DataControlField クラスで定義されたプロパティを初期化します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataControlField クラス
DataControlField メンバ
System.Web.UI.WebControls 名前空間
BoundField クラス
ButtonFieldBase クラス
CheckBoxField クラス
CommandField クラス
HyperLinkField
ImageField
TemplateField

DataControlField プロパティ


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

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

関連項目

DataControlField クラス
System.Web.UI.WebControls 名前空間
BoundField クラス
ButtonFieldBase クラス
CheckBoxField クラス
CommandField クラス
HyperLinkField
ImageField
TemplateField

DataControlField メソッド


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

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ExtractValuesFromCell 現在のテーブル セルからデータ コントロール フィールドの値を抽出し、指定した IDictionary コレクションにその値を追加します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド Initialize データ コントロール フィールドのインスタンスの基本的な初期化を実行します。
パブリック メソッド InitializeCell セルのコントロールのコレクションにテキストまたはコントロールを追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。 この DataControlField オブジェクトを表す文字列を返します。
パブリック メソッド ValidateSupportsCallback 派生クラス内でオーバーライドされた場合は、フィールドに格納されているコントロールがコールバックをサポートすることを通知します。
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState データ コントロール フィールドの、以前保存したビューステートを復元します。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState ページがサーバーにポストバックされた時間以降に発生した、DataControlField ビューステートへの変更を保存します。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState DataControlField オブジェクトがそのビューステートの変更を追跡するようにします。それにより、変更をコントロールの ViewState プロパティに格納して、同じページに対する複数の要求にわたって永続化できます。
参照参照

関連項目

DataControlField クラス
System.Web.UI.WebControls 名前空間
BoundField クラス
ButtonFieldBase クラス
CheckBoxField クラス
CommandField クラス
HyperLinkField
ImageField
TemplateField

DataControlField メンバ

DetailsView、GridView など、表形式のデータ バインド コントロールのデータ列を表すすべての種類のデータ コントロール フィールドの基本クラスとして機能します。

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


プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド DataControlField DataControlField クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ AccessibleHeaderText 一部のコントロールの AbbreviatedText プロパティ値として表示されるテキストを取得または設定します。
パブリック プロパティ ControlStyle DataControlField オブジェクトに格納されているすべての Web サーバー コントロールのスタイルを取得または設定します。
パブリック プロパティ FooterStyle データ コントロール フィールドのフッターのスタイルを取得または設定します。
パブリック プロパティ FooterText データ コントロール フィールドのフッター項目に表示されるテキストを取得または設定します。
パブリック プロパティ HeaderImageUrl データ コントロール フィールドのヘッダー項目に表示されるイメージの URL を取得または設定します。
パブリック プロパティ HeaderStyle データ コントロール フィールドのヘッダーのスタイルを取得または設定します。
パブリック プロパティ HeaderText データ コントロール フィールドのヘッダー項目に表示されるテキストを取得または設定します。
パブリック プロパティ InsertVisible DataControlField オブジェクトの親データ バインド コントロールが挿入モードの場合に、このオブジェクトが表示されるかどうかを示す値を取得します。
パブリック プロパティ ItemStyle データ コントロール フィールドで表示されるテキスト ベースの内容のスタイルを取得します。
パブリック プロパティ ShowHeader データ コントロール フィールドのヘッダー項目を表示するかどうかを示す値を取得または設定します。
パブリック プロパティ SortExpression データ ソース コントロールでデータを並べ替えるために使用される並べ替え式を、取得または設定します。
パブリック プロパティ Visible データ コントロール フィールドを表示するかどうかを示す値を取得または設定します。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ Control DataControlField オブジェクトが関連付けられているデータ コントロールの参照を取得します。
プロテクト プロパティ DesignMode デザイン時環境で、現在データ コントロール フィールドが表示されているかどうかを示す値を取得します。
プロテクト プロパティ IsTrackingViewState DataControlField オブジェクトがビューステートへの変更を保存しているかどうかを示す値を取得します。
プロテクト プロパティ ViewState 同一のページに対する複数の要求にわたって、DataControlField オブジェクトのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド ExtractValuesFromCell 現在のテーブル セルからデータ コントロール フィールドの値を抽出し、指定した IDictionary コレクションにその値を追加します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド Initialize データ コントロール フィールドのインスタンスの基本的な初期化を実行します。
パブリック メソッド InitializeCell セルのコントロールのコレクションにテキストまたはコントロールを追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。 この DataControlField オブジェクトを表す文字列を返します。
パブリック メソッド ValidateSupportsCallback 派生クラス内でオーバーライドされた場合は、フィールドに格納されているコントロールがコールバックをサポートすることを通知します。
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState データ コントロール フィールドの、以前保存したビューステートを復元します。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState ページがサーバーにポストバックされた時間以降に発生した、DataControlField ビューステートへの変更を保存します。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState DataControlField オブジェクトがそのビューステートの変更を追跡するようにします。それにより、変更をコントロールの ViewState プロパティに格納して、同じページに対する複数の要求にわたって永続化できます。
インターフェイスの明示的な実装 System.Web.UI.IDataSourceViewSchemaAccessor.DataSourceViewSchema この DataControlField オブジェクトに関連付けられているスキーマを取得または設定します。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.IsTrackingViewState DataControlField オブジェクトがビューステートへの変更を保存しているかどうかを示す値を取得します。
参照参照

関連項目

DataControlField クラス
System.Web.UI.WebControls 名前空間
BoundField クラス
ButtonFieldBase クラス
CheckBoxField クラス
CommandField クラス
HyperLinkField
ImageField
TemplateField



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「DataControlField」の関連用語

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

   

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



DataControlFieldのページの著作権

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

©2026 GRAS Group, Inc.RSS