DataSourceControl クラス

定義

データ バインド コントロールに対してデータ ソースを表すコントロールの基底クラスとして機能します。

public ref class DataSourceControl abstract : System::Web::UI::Control, System::ComponentModel::IListSource, System::Web::UI::IDataSource
[System.ComponentModel.Bindable(false)]
public abstract class DataSourceControl : System.Web.UI.Control, System.ComponentModel.IListSource, System.Web.UI.IDataSource
[<System.ComponentModel.Bindable(false)>]
type DataSourceControl = class
    inherit Control
    interface IDataSource
    interface IListSource
Public MustInherit Class DataSourceControl
Inherits Control
Implements IDataSource, IListSource
継承
DataSourceControl
派生
属性
実装

次のコード例では、クラスで クラスを拡張する方法を DataSourceControl 示します。 コントロールは CsvDataSource 、.csv ファイルに格納されているコンマ区切りのファイル データを表します。 基底クラスのGetView実装は機能しないため、 クラスはCsvDataSource、、GetViewNames、およびその他のメソッドの独自の実装を提供します。

using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

// The CsvDataSource is a data source control that retrieves its
// data from a comma-separated value file.
[AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
public class CsvDataSource : DataSourceControl
{
    public CsvDataSource() : base() {}

    // The comma-separated value file to retrieve data from.
    public string FileName {
        get {
            return ((CsvDataSourceView)this.GetView(String.Empty)).SourceFile;
        }
        set {
            // Only set if it is different.
            if ( ((CsvDataSourceView)this.GetView(String.Empty)).SourceFile != value) {
                ((CsvDataSourceView)this.GetView(String.Empty)).SourceFile = value;
                RaiseDataSourceChangedEvent(EventArgs.Empty);
            }
        }
    }

    // Do not add the column names as a data row. Infer columns if the CSV file does
    // not include column names.
    public bool IncludesColumnNames {
        get {
            return ((CsvDataSourceView)this.GetView(String.Empty)).IncludesColumnNames;
        }
        set {
            // Only set if it is different.
            if ( ((CsvDataSourceView)this.GetView(String.Empty)).IncludesColumnNames != value) {
                ((CsvDataSourceView)this.GetView(String.Empty)).IncludesColumnNames = value;
                RaiseDataSourceChangedEvent(EventArgs.Empty);
            }
        }
    }

    // Return a strongly typed view for the current data source control.
    private CsvDataSourceView view = null;
    protected override DataSourceView GetView(string viewName) {
        if (null == view) {
            view = new CsvDataSourceView(this, String.Empty);
        }
        return view;
    }
    // The ListSourceHelper class calls GetList, which
    // calls the DataSourceControl.GetViewNames method.
    // Override the original implementation to return
    // a collection of one element, the default view name.
    protected override ICollection GetViewNames() {
        ArrayList al = new ArrayList(1);
        al.Add(CsvDataSourceView.DefaultViewName);
        return al as ICollection;
    }
}

// The CsvDataSourceView class encapsulates the
// capabilities of the CsvDataSource data source control.
public class CsvDataSourceView : DataSourceView
{

    public CsvDataSourceView(IDataSource owner, string name) :base(owner, DefaultViewName) {
    }

    // The data source view is named. However, the CsvDataSource
    // only supports one view, so the name is ignored, and the
    // default name used instead.
    public static string DefaultViewName = "CommaSeparatedView";

    // The location of the .csv file.
    private string sourceFile = String.Empty;
    internal string SourceFile {
        get {
            return sourceFile;
        }
        set {
            // Use MapPath when the SourceFile is set, so that files local to the
            // current directory can be easily used.
            string mappedFileName = HttpContext.Current.Server.MapPath(value);
            sourceFile = mappedFileName;
        }
    }

    // Do not add the column names as a data row. Infer columns if the CSV file does
    // not include column names.
    private bool columns = false;
    internal bool IncludesColumnNames {
        get {
            return columns;
        }
        set {
            columns = value;
        }
    }

    // Get data from the underlying data source.
    // Build and return a DataView, regardless of mode.
    protected override IEnumerable ExecuteSelect(DataSourceSelectArguments selectArgs) {
        IEnumerable dataList = null;
        // Open the .csv file.
        if (File.Exists(this.SourceFile)) {
            DataTable data = new DataTable();

            // Open the file to read from.
            using (StreamReader sr = File.OpenText(this.SourceFile)) {
                // Parse the line
                string s = "";
                string[] dataValues;
                DataColumn col;

                // Do the following to add schema.
                dataValues = sr.ReadLine().Split(',');
                // For each token in the comma-delimited string, add a column
                // to the DataTable schema.
                foreach (string token in dataValues) {
                    col = new DataColumn(token,typeof(string));
                    data.Columns.Add(col);
                }

                // Do not add the first row as data if the CSV file includes column names.
                if (! IncludesColumnNames)
                    data.Rows.Add(CopyRowData(dataValues, data.NewRow()));

                // Do the following to add data.
                while ((s = sr.ReadLine()) != null) {
                    dataValues = s.Split(',');
                    data.Rows.Add(CopyRowData(dataValues, data.NewRow()));
                }
            }
            data.AcceptChanges();
            DataView dataView = new DataView(data);
            if (!string.IsNullOrEmpty(selectArgs.SortExpression)) {
                dataView.Sort = selectArgs.SortExpression;
            }
            dataList = dataView;
        }
        else {
            throw new System.Configuration.ConfigurationErrorsException("File not found, " + this.SourceFile);
        }

        if (null == dataList) {
            throw new InvalidOperationException("No data loaded from data source.");
        }

        return dataList;
    }

    private DataRow CopyRowData(string[] source, DataRow target) {
        try {
            for (int i = 0;i < source.Length;i++) {
                target[i] = source[i];
            }
        }
        catch (System.IndexOutOfRangeException) {
            // There are more columns in this row than
            // the original schema allows.  Stop copying
            // and return the DataRow.
            return target;
        }
        return target;
    }
    // The CsvDataSourceView does not currently
    // permit deletion. You can modify or extend
    // this sample to do so.
    public override bool CanDelete {
        get {
            return false;
        }
    }
    protected override int ExecuteDelete(IDictionary keys, IDictionary values)
    {
        throw new NotSupportedException();
    }
    // The CsvDataSourceView does not currently
    // permit insertion of a new record. You can
    // modify or extend this sample to do so.
    public override bool CanInsert {
        get {
            return false;
        }
    }
    protected override int ExecuteInsert(IDictionary values)
    {
        throw new NotSupportedException();
    }
    // The CsvDataSourceView does not currently
    // permit update operations. You can modify or
    // extend this sample to do so.
    public override bool CanUpdate {
        get {
            return false;
        }
    }
    protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)
    {
        throw new NotSupportedException();
    }
}
Imports System.Collections
Imports System.Data
Imports System.IO
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Samples.AspNet.VB.Controls

' The CsvDataSource is a data source control that retrieves its
' data from a comma-separated value file.
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class CsvDataSource
   Inherits DataSourceControl

   Public Sub New()
   End Sub

   ' The comma-separated value file to retrieve data from.
   Public Property FileName() As String
      Get
         Return CType(Me.GetView([String].Empty), CsvDataSourceView).SourceFile
      End Get
      Set
         ' Only set if it is different.
         If CType(Me.GetView([String].Empty), CsvDataSourceView).SourceFile <> value Then
            CType(Me.GetView([String].Empty), CsvDataSourceView).SourceFile = value
            RaiseDataSourceChangedEvent(EventArgs.Empty)
         End If
      End Set
   End Property

   ' Do not add the column names as a data row. Infer columns if the CSV file does
   ' not include column names.

   Public Property IncludesColumnNames() As Boolean
      Get
         Return CType(Me.GetView([String].Empty), CsvDataSourceView).IncludesColumnNames
      End Get
      Set
         ' Only set if it is different.
         If CType(Me.GetView([String].Empty), CsvDataSourceView).IncludesColumnNames <> value Then
            CType(Me.GetView([String].Empty), CsvDataSourceView).IncludesColumnNames = value
            RaiseDataSourceChangedEvent(EventArgs.Empty)
         End If
      End Set
   End Property


   ' Return a strongly typed view for the current data source control.
   Private view As CsvDataSourceView = Nothing

   Protected Overrides Function GetView(viewName As String) As DataSourceView
      If view Is Nothing Then
         view = New CsvDataSourceView(Me, String.Empty)
      End If
      Return view
   End Function 'GetView

   ' The ListSourceHelper class calls GetList, which
   ' calls the DataSourceControl.GetViewNames method.
   ' Override the original implementation to return
   ' a collection of one element, the default view name.
   Protected Overrides Function GetViewNames() As ICollection
      Dim al As New ArrayList(1)
      al.Add(CsvDataSourceView.DefaultViewName)
      Return CType(al, ICollection)
   End Function 'GetViewNames

End Class


' The CsvDataSourceView class encapsulates the
' capabilities of the CsvDataSource data source control.

Public Class CsvDataSourceView
   Inherits DataSourceView

   Public Sub New(owner As IDataSource, name As String)
       MyBase.New(owner, DefaultViewName)
   End Sub

   ' The data source view is named. However, the CsvDataSource
   ' only supports one view, so the name is ignored, and the
   ' default name used instead.
   Public Shared DefaultViewName As String = "CommaSeparatedView"

   ' The location of the .csv file.
   Private aSourceFile As String = [String].Empty

   Friend Property SourceFile() As String
      Get
         Return aSourceFile
      End Get
      Set
         ' Use MapPath when the SourceFile is set, so that files local to the
         ' current directory can be easily used.
         Dim mappedFileName As String
         mappedFileName = HttpContext.Current.Server.MapPath(value)
         aSourceFile = mappedFileName
      End Set
   End Property

   ' Do not add the column names as a data row. Infer columns if the CSV file does
   ' not include column names.
   Private columns As Boolean = False

   Friend Property IncludesColumnNames() As Boolean
      Get
         Return columns
      End Get
      Set
         columns = value
      End Set
   End Property

   ' Get data from the underlying data source.
   ' Build and return a DataView, regardless of mode.
   Protected Overrides Function ExecuteSelect(selectArgs As DataSourceSelectArguments) _
    As System.Collections.IEnumerable
      Dim dataList As IEnumerable = Nothing
      ' Open the .csv file.
      If File.Exists(Me.SourceFile) Then
         Dim data As New DataTable()

         ' Open the file to read from.
         Dim sr As StreamReader = File.OpenText(Me.SourceFile)

         Try
            ' Parse the line
            Dim dataValues() As String
            Dim col As DataColumn

            ' Do the following to add schema.
            dataValues = sr.ReadLine().Split(","c)
            ' For each token in the comma-delimited string, add a column
            ' to the DataTable schema.
            Dim token As String
            For Each token In dataValues
               col = New DataColumn(token, System.Type.GetType("System.String"))
               data.Columns.Add(col)
            Next token

            ' Do not add the first row as data if the CSV file includes column names.
            If Not IncludesColumnNames Then
               data.Rows.Add(CopyRowData(dataValues, data.NewRow()))
            End If

            ' Do the following to add data.
            Dim s As String
            Do
               s = sr.ReadLine()
               If Not s Is Nothing Then
                   dataValues = s.Split(","c)
                   data.Rows.Add(CopyRowData(dataValues, data.NewRow()))
               End If
            Loop Until s Is Nothing

         Finally
            sr.Close()
         End Try

         data.AcceptChanges()
         Dim dataView As New DataView(data)
         If Not selectArgs.SortExpression Is String.Empty Then
             dataView.Sort = selectArgs.SortExpression
         End If
         dataList = dataView
      Else
         Throw New System.Configuration.ConfigurationErrorsException("File not found, " + Me.SourceFile)
      End If

      If dataList is Nothing Then
         Throw New InvalidOperationException("No data loaded from data source.")
      End If

      Return dataList
   End Function 'ExecuteSelect


   Private Function CopyRowData([source]() As String, target As DataRow) As DataRow
      Try
         Dim i As Integer
         For i = 0 To [source].Length - 1
            target(i) = [source](i)
         Next i
      Catch iore As IndexOutOfRangeException
         ' There are more columns in this row than
         ' the original schema allows.  Stop copying
         ' and return the DataRow.
         Return target
      End Try
      Return target
   End Function 'CopyRowData

   ' The CsvDataSourceView does not currently
   ' permit deletion. You can modify or extend
   ' this sample to do so.
   Public Overrides ReadOnly Property CanDelete() As Boolean
      Get
         Return False
      End Get
   End Property

   Protected Overrides Function ExecuteDelete(keys As IDictionary, values As IDictionary) As Integer
      Throw New NotSupportedException()
   End Function 'ExecuteDelete

   ' The CsvDataSourceView does not currently
   ' permit insertion of a new record. You can
   ' modify or extend this sample to do so.
   Public Overrides ReadOnly Property CanInsert() As Boolean
      Get
         Return False
      End Get
   End Property

   Protected Overrides Function ExecuteInsert(values As IDictionary) As Integer
      Throw New NotSupportedException()
   End Function 'ExecuteInsert

   ' The CsvDataSourceView does not currently
   ' permit update operations. You can modify or
   ' extend this sample to do so.
   Public Overrides ReadOnly Property CanUpdate() As Boolean
      Get
         Return False
      End Get
   End Property

   Protected Overrides Function ExecuteUpdate(keys As IDictionary, _
                                              values As IDictionary, _
                                              oldValues As IDictionary) As Integer
      Throw New NotSupportedException()
   End Function 'ExecuteUpdate

End Class
End Namespace

次のコード例は、Web フォームで コントロールを使用する CsvDataSource 方法を示しています。

<%@ Page Language="C#" %>
<%@ Register Tagprefix="aspSample"
             Namespace="Samples.AspNet.CS.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <asp:gridview
          id="GridView1"
          runat="server"
          allowsorting="True"
          datasourceid="CsvDataSource1" />

      <aspSample:CsvDataSource
          id = "CsvDataSource1"
          runat = "server"
          filename = "sample.csv"
          includescolumnnames="True" />

    </form>
  </body>
</html>
<%@ Page Language="VB" %>
<%@ Register Tagprefix="aspSample"
             Namespace="Samples.AspNet.VB.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <asp:gridview
                id="GridView1"
                runat="server"
                allowsorting="True"
                datasourceid="CsvDataSource1" />

            <aspSample:CsvDataSource
                id = "CsvDataSource1"
                runat = "server"
                filename = "sample.csv"
                includescolumnnames="True" />

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

注釈

ASP.NET では、Web サーバー コントロールが一貫した方法でデータにバインドできるようにするコントロール データ バインディング アーキテクチャがサポートされています。 データにバインドする Web サーバー コントロールは、データ バインド コントロールと呼ばれ、そのバインドを容易にするクラスはデータ ソース コントロールと呼ばれます。 データ ソース コントロールは、リレーショナル データベース、ファイル、ストリーム、ビジネス オブジェクトなどの任意のデータ ソースを表すことができます。 データ ソース コントロールは、基になるデータのソースまたは形式に関係なく、データ バインド コントロールに対して一貫した方法でデータを表示します。

ほとんどの Web 開発タスクを実行するには、、、、 などSqlDataSourceAccessDataSourceXmlDataSource、ASP.NET で提供されるデータ ソース コントロールを使用します。 独自のカスタム データ ソース管理を実装する場合は、 基本 DataSourceControl クラスを使用します。

インターフェイスを IDataSource 実装するクラスはデータ ソース コントロールですが、ほとんどの ASP.NET データ ソース コントロールは抽象 DataSourceControl クラスを拡張し、インターフェイスの基本実装を IDataSource 提供します。 クラスには DataSourceControl インターフェイスの IListSource 実装も用意されています。これにより、データ ソース コントロールをデータ バインド コントロールの プロパティに DataSource プログラムで割り当て、基本的なリストとしてコントロールにデータを返すこともできます。

クラスから派生するすべての ASP.NET コントロールは DataBoundControl 、データ ソース コントロールにバインドできます。 DataBoundControlがデータ ソース コントロールにバインドされると、実行時にデータ バインディングが自動的に実行されます。 または DataSourceID プロパティを公開DataSourceし、基本的なデータ バインディングをサポートするが、 からDataBoundControl派生していない ASP.NET コントロールでデータ ソース コントロールを使用することもできます。 これらのデータ バインド コントロールを使用する場合は、 メソッドを明示的に呼び出す DataBind 必要があります。 データ バインディングの詳細については、「ASP.NET データ アクセス コンテンツ マップ」を参照してください。

データ ソース コントロールは、データ ソース ビューと呼ばれる、オブジェクトとそれに関連付けられているデータ リストの組み合わせ DataSourceControl と考えることができます。 データの各リストは、 オブジェクトによって DataSourceView 表されます。 基になるデータ ストレージには 1 つ以上のデータ リストが含まれているため、 DataSourceControl は常に 1 つ以上の名前付き DataSourceView オブジェクトに関連付けられます。 インターフェイスは IDataSource 、すべてのデータ ソース コントロールがデータ ソース ビュー GetViewNames の操作に使用するメソッドを定義します。このメソッドは、現在データ ソース コントロールに関連付けられているデータ ソース ビューを列挙するために使用され GetView 、メソッドを使用して特定のデータ ソース ビュー インスタンスを名前で取得します。

また、データ ソース管理は、呼び出し元がデータへのアクセスに使用する 2 つの異なるインターフェイスと考えることができます。 クラスはDataSourceControl、ページ開発者がWeb Forms ページを開発するときに直接操作するインターフェイスでありDataSourceView、 クラスは、データ バインド コントロールとデータ バインド コントロール作成者が対話するインターフェイスです。 DataSourceViewオブジェクトは実行時にのみ使用できるため、データ ソース コントロールまたはデータ ソース ビューに保持される状態は、データ ソース コントロールによって直接公開される必要があります。

ASP.NET データ ソース コントロールの視覚的なレンダリングはありません。これらはコントロールとして実装されるため、宣言的に作成し、必要に応じて状態管理に参加できるようにします。 その結果、データ ソース コントロールでは、 や SkinIDなどのEnableThemingビジュアル機能はサポートされません。

コンストラクター

DataSourceControl()

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

プロパティ

Adapter

コントロール用のブラウザー固有のアダプターを取得します。

(継承元 Control)
AppRelativeTemplateSourceDirectory

このコントロールが含まれている Page オブジェクトまたは UserControl オブジェクトのアプリケーション相対の仮想ディレクトリを取得または設定します。

(継承元 Control)
BindingContainer

このコントロールのデータ バインディングを格納しているコントロールを取得します。

(継承元 Control)
ChildControlsCreated

サーバー コントロールの子コントロールが作成されたかどうかを示す値を取得します。

(継承元 Control)
ClientID

ASP.NET によって生成されたサーバー コントロール ID を取得します。

ClientIDMode

このプロパティは、データ ソース コントロールでは使用されません。

ClientIDMode

ClientID プロパティの値を生成するために使用されるアルゴリズムを取得または設定します。

(継承元 Control)
ClientIDSeparator

ClientID プロパティで使用される区切り記号を表す文字値を取得します。

(継承元 Control)
Context

現在の Web 要求に対するサーバー コントロールに関連付けられている HttpContext オブジェクトを取得します。

(継承元 Control)
Controls

UI 階層内の指定されたサーバー コントロールの子コントロールを表す ControlCollection オブジェクトを取得します。

DataItemContainer

名前付けコンテナーが IDataItemContainer を実装している場合、名前付けコンテナーへの参照を取得します。

(継承元 Control)
DataKeysContainer

名前付けコンテナーが IDataKeysControl を実装している場合、名前付けコンテナーへの参照を取得します。

(継承元 Control)
DesignMode

コントロールがデザイン サーフェイスで使用されているかどうかを示す値を取得します。

(継承元 Control)
EnableTheming

このコントロールがテーマをサポートしているかどうかを示す値を取得します。

EnableViewState

要求元クライアントに対して、サーバー コントロールがそのビュー状態と、そこに含まれる任意の子のコントロールのビュー状態を保持するかどうかを示す値を取得または設定します。

(継承元 Control)
Events

コントロールのイベント ハンドラー デリゲートのリストを取得します。 このプロパティは読み取り専用です。

(継承元 Control)
HasChildViewState

現在のサーバー コントロールの子コントロールが、保存されたビューステートの設定を持っているかどうかを示す値を取得します。

(継承元 Control)
ID

サーバー コントロールに割り当てられたプログラム ID を取得または設定します。

(継承元 Control)
IdSeparator

コントロール ID を区別するために使用する文字を取得します。

(継承元 Control)
IsChildControlStateCleared

このコントロールに含まれているコントロールに、コントロールの状態が設定されているかどうかを示す値を取得します。

(継承元 Control)
IsTrackingViewState

サーバー コントロールがビューステートの変更を保存しているかどうかを示す値を取得します。

(継承元 Control)
IsViewStateEnabled

このコントロールでビューステートが有効かどうかを示す値を取得します。

(継承元 Control)
LoadViewStateByID

コントロールがインデックスではなく ID によりビューステートの読み込みを行うかどうかを示す値を取得します。

(継承元 Control)
NamingContainer

同じ ID プロパティ値を持つ複数のサーバー コントロールを区別するための一意の名前空間を作成する、サーバー コントロールの名前付けコンテナーへの参照を取得します。

(継承元 Control)
Page

サーバー コントロールを含んでいる Page インスタンスへの参照を取得します。

(継承元 Control)
Parent

ページ コントロールの階層構造における、サーバー コントロールの親コントロールへの参照を取得します。

(継承元 Control)
RenderingCompatibility

レンダリングされる HTML と互換性がある ASP.NET のバージョンを表す値を取得します。

(継承元 Control)
Site

デザイン サーフェイスに現在のコントロールを表示するときに、このコントロールをホストするコンテナーに関する情報を取得します。

(継承元 Control)
SkinID

DataSourceControl コントロールに適用するスキンを取得します。

TemplateControl

このコントロールを格納しているテンプレートへの参照を取得または設定します。

(継承元 Control)
TemplateSourceDirectory

現在のサーバー コントロールを格納している Page または UserControl の仮想ディレクトリを取得します。

(継承元 Control)
UniqueID

階層構造で修飾されたサーバー コントロールの一意の ID を取得します。

(継承元 Control)
ValidateRequestMode

ブラウザーからのクライアント入力の安全性をコントロールで調べるかどうかを示す値を取得または設定します。

(継承元 Control)
ViewState

同一のページに対する複数の要求にわたって、サーバー コントロールのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。

(継承元 Control)
ViewStateIgnoresCase

StateBag オブジェクトが大文字小文字を区別しないかどうかを示す値を取得します。

(継承元 Control)
ViewStateMode

このコントロールのビューステート モードを取得または設定します。

(継承元 Control)
Visible

コントロールが視覚的に表示されているかどうかを示す値を取得または設定します。

メソッド

AddedControl(Control, Int32)

子コントロールが Control オブジェクトの Controls コレクションに追加された後に呼び出されます。

(継承元 Control)
AddParsedSubObject(Object)

XML または HTML のいずれかの要素が解析されたことをサーバー コントロールに通知し、サーバー コントロールの ControlCollection オブジェクトに要素を追加します。

(継承元 Control)
ApplyStyleSheetSkin(Page)

ページのスタイル シートに定義されたスタイル プロパティをコントロールに適用します。

BeginRenderTracing(TextWriter, Object)

レンダリング データのデザイン時のトレースを開始します。

(継承元 Control)
BuildProfileTree(String, Boolean)

ページのトレースが有効な場合、サーバー コントロールに関する情報を収集し、これを表示するために Trace プロパティに渡します。

(継承元 Control)
ClearCachedClientID()

キャッシュされた ClientID 値を null に設定します。

(継承元 Control)
ClearChildControlState()

サーバー コントロールのすべての子コントロールについて、コントロールの状態情報を削除します。

(継承元 Control)
ClearChildState()

サーバー コントロールのすべての子コントロールのビューステート情報およびコントロールの状態情報を削除します。

(継承元 Control)
ClearChildViewState()

サーバー コントロールのすべての子コントロールのビューステート情報を削除します。

(継承元 Control)
ClearEffectiveClientIDMode()

現在のコントロール インスタンスおよびすべての子コントロールの ClientIDMode プロパティを Inherit に設定します。

(継承元 Control)
CreateChildControls()

ASP.NET ページ フレームワークによって呼び出され、ポストバックまたはレンダリングの準備として、合成ベースの実装を使うサーバー コントロールに対し、それらのコントロールに含まれる子コントロールを作成するように通知します。

(継承元 Control)
CreateControlCollection()

子コントロールを格納するコレクションを作成します。

DataBind()

呼び出されたサーバー コントロールとそのすべての子コントロールにデータ ソースをバインドします。

(継承元 Control)
DataBind(Boolean)

DataBinding イベントを発生させるオプションを指定して、呼び出されたサーバー コントロールとそのすべての子コントロールにデータ ソースをバインドします。

(継承元 Control)
DataBindChildren()

データ ソースをサーバー コントロールの子コントロールにバインドします。

(継承元 Control)
Dispose()

サーバー コントロールが、メモリから解放される前に最終的なクリーンアップを実行できるようにします。

(継承元 Control)
EndRenderTracing(TextWriter, Object)

レンダリング データのデザイン時のトレースを終了します。

(継承元 Control)
EnsureChildControls()

サーバー コントロールに子コントロールが含まれているかどうかを確認します。 含まれていない場合、子コントロールを作成します。

(継承元 Control)
EnsureID()

ID が割り当てられていないコントロールの ID を作成します。

(継承元 Control)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FindControl(String)

指定した id パラメーターを使用して、サーバー コントロールの現在の名前付けコンテナーを検索します。

FindControl(String, Int32)

指定した id および検索に役立つ pathOffset パラメーターに指定された整数を使用して、サーバー コントロールの現在の名前付けコンテナーを検索します。 この形式の FindControl メソッドはオーバーライドしないでください。

(継承元 Control)
Focus()

コントロールに入力フォーカスを設定します。

GetDesignModeState()

コントロールのデザイン時データを取得します。

(継承元 Control)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetRouteUrl(Object)

ルート パラメーターのセットに対応する URL を取得します。

(継承元 Control)
GetRouteUrl(RouteValueDictionary)

ルート パラメーターのセットに対応する URL を取得します。

(継承元 Control)
GetRouteUrl(String, Object)

ルート パラメーターのセットおよびルート名に対応する URL を取得します。

(継承元 Control)
GetRouteUrl(String, RouteValueDictionary)

ルート パラメーターのセットおよびルート名に対応する URL を取得します。

(継承元 Control)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetUniqueIDRelativeTo(Control)

指定されたコントロールの UniqueID プロパティのプレフィックス部分を返します。

(継承元 Control)
GetView(String)

データ ソース コントロールに関連付けられた名前付きデータ ソース ビューを取得します。

GetViewNames()

DataSourceView コントロールに関連付けられた DataSourceControl オブジェクトのリストを表す名前のコレクションを取得します。

HasControls()

サーバー コントロールに子コントロールが含まれているかどうかを確認します。

HasEvents()

コントロールまたは子コントロールに対してイベントが登録されているかどうかを示す値を返します。

(継承元 Control)
IsLiteralContent()

サーバー コントロールがリテラルな内容だけを保持しているかどうかを決定します。

(継承元 Control)
LoadControlState(Object)

SaveControlState() メソッドによって保存された前回のページ要求からコントロールの状態情報を復元します。

(継承元 Control)
LoadViewState(Object)

SaveViewState() メソッドによって保存された前回のページ要求からビューステート情報を復元します。

(継承元 Control)
MapPathSecure(String)

仮想パス (絶対パスまたは相対パス) の割り当て先の物理パスを取得します。

(継承元 Control)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
OnBubbleEvent(Object, EventArgs)

サーバー コントロールのイベントをページの UI サーバー コントロールの階層構造に渡すかどうかを決定します。

(継承元 Control)
OnDataBinding(EventArgs)

DataBinding イベントを発生させます。

(継承元 Control)
OnInit(EventArgs)

Init イベントを発生させます。

(継承元 Control)
OnLoad(EventArgs)

Load イベントを発生させます。

(継承元 Control)
OnPreRender(EventArgs)

PreRender イベントを発生させます。

(継承元 Control)
OnUnload(EventArgs)

Unload イベントを発生させます。

(継承元 Control)
OpenFile(String)

ファイルの読み込みで使用される Stream を取得します。

(継承元 Control)
RaiseBubbleEvent(Object, EventArgs)

イベントのソースおよびその情報をコントロールの親に割り当てます。

(継承元 Control)
RaiseDataSourceChangedEvent(EventArgs)

DataSourceChanged イベントを発生させます。

RemovedControl(Control)

Control オブジェクトの Controls コレクションから子コントロールが削除された後に呼び出されます。

(継承元 Control)
Render(HtmlTextWriter)

提供されたクライアントに表示される内容を書き込む HtmlTextWriter オブジェクトに、サーバー コントロールの内容を送信します。

(継承元 Control)
RenderChildren(HtmlTextWriter)

提供された HtmlTextWriter オブジェクトに対してサーバー コントロールの子のコンテンツを出力すると、クライアントで表示されるコンテンツが記述されます。

(継承元 Control)
RenderControl(HtmlTextWriter)

指定の HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力し、トレースが有効である場合はコントロールに関するトレース情報を保存します。

RenderControl(HtmlTextWriter, ControlAdapter)

指定した ControlAdapter オブジェクトを使用して、指定した HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力します。

(継承元 Control)
ResolveAdapter()

指定したコントロールを表示するコントロール アダプターを取得します。

(継承元 Control)
ResolveClientUrl(String)

ブラウザーで使用できる URL を取得します。

(継承元 Control)
ResolveUrl(String)

要求側クライアントで使用できる URL に変換します。

(継承元 Control)
SaveControlState()

ページがサーバーにポスト バックされた時間以降に発生したすべてのサーバー コントロール状態の変化を保存します。

(継承元 Control)
SaveViewState()

ページがサーバーにポスト バックされた時間以降に発生した、サーバー コントロールのビューステートの変更を保存します。

(継承元 Control)
SetDesignModeState(IDictionary)

コントロールのデザイン時データを設定します。

(継承元 Control)
SetRenderMethodDelegate(RenderMethod)

サーバー コントロールとその内容を親コントロールに表示するイベント ハンドラー デリゲートを割り当てます。

(継承元 Control)
SetTraceData(Object, Object)

トレース データ キーとトレース データ値を使用して、レンダリング データのデザイン時トレースのトレース データを設定します。

(継承元 Control)
SetTraceData(Object, Object, Object)

トレースされたオブジェクト、トレース データ キー、およびトレース データ値を使用して、レンダリング データのデザイン時トレースのトレース データを設定します。

(継承元 Control)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TrackViewState()

サーバー コントロールにビューステートの変更を追跡させ、サーバー コントロールの StateBag オブジェクトに変更を格納できるようにします。 このオブジェクトは、ViewState プロパティによってアクセスできます。

(継承元 Control)

イベント

DataBinding

サーバー コントロールがデータ ソースに連結すると発生します。

(継承元 Control)
Disposed

サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。

(継承元 Control)
Init

サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。

(継承元 Control)
Load

サーバー コントロールが Page オブジェクトに読み込まれると発生します。

(継承元 Control)
PreRender

Control オブジェクトの読み込み後、表示を開始する前に発生します。

(継承元 Control)
Unload

サーバー コントロールがメモリからアンロードされると発生します。

(継承元 Control)

明示的なインターフェイスの実装

IControlBuilderAccessor.ControlBuilder

このメンバーの詳細については、「ControlBuilder」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.GetDesignModeState()

このメンバーの詳細については、「GetDesignModeState()」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

このメンバーの詳細については、「SetDesignModeState(IDictionary)」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

このメンバーの詳細については、「SetOwnerControl(Control)」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.UserData

このメンバーの詳細については、「UserData」をご覧ください。

(継承元 Control)
IDataBindingsAccessor.DataBindings

このメンバーの詳細については、「DataBindings」をご覧ください。

(継承元 Control)
IDataBindingsAccessor.HasDataBindings

このメンバーの詳細については、「HasDataBindings」をご覧ください。

(継承元 Control)
IDataSource.DataSourceChanged

データ バインド コントロールに影響を与えるようにデータ ソース コントロールが変更されたときに発生します。

IDataSource.GetView(String)

DataSourceView コントロールに関連付けられている名前付きの DataSourceControl オブジェクトを取得します。 データ ソース コントロールには、1 つのビューしかサポートしていないものもあれば、複数のビューをサポートするものもあります。

IDataSource.GetViewNames()

DataSourceView コントロールに関連付けられた DataSourceControl オブジェクトのリストを表す名前のコレクションを取得します。

IExpressionsAccessor.Expressions

このメンバーの詳細については、「Expressions」をご覧ください。

(継承元 Control)
IExpressionsAccessor.HasExpressions

このメンバーの詳細については、「HasExpressions」をご覧ください。

(継承元 Control)
IListSource.ContainsListCollection

データ ソース コントロールが 1 つ以上のデータのリストに関連付けられているかどうかを示します。

IListSource.GetList()

データのリストのソースとして使用できるデータ ソース コントロールのリストを取得します。

IParserAccessor.AddParsedSubObject(Object)

このメンバーの詳細については、「AddParsedSubObject(Object)」をご覧ください。

(継承元 Control)

拡張メソッド

FindDataSourceControl(Control)

指定されたコントロールのデータ コントロールに関連付けられているデータ ソースを返します。

FindFieldTemplate(Control, String)

指定されたコントロールの名前付けコンテナー内にある、指定された列のフィールド テンプレートを返します。

FindMetaTable(Control)

格納しているデータ コントロールのメタテーブル オブジェクトを返します。

GetDefaultValues(IDataSource)

指定されたデータ ソースの既定値のコレクションを取得します。

GetMetaTable(IDataSource)

指定したデータ ソース オブジェクト内のテーブルのメタデータを取得します。

TryGetMetaTable(IDataSource, MetaTable)

テーブル メタデータが使用できるかどうかを判断します。

適用対象

こちらもご覧ください