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

DataControlFieldCell クラス

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

DetailsView、GridView などの表形式ASP.NET データ バインド コントロールの、表示された表内のセル表します

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

Public Class DataControlFieldCell
    Inherits TableCell
Dim instance As DataControlFieldCell
public class DataControlFieldCell : TableCell
public ref class DataControlFieldCell : public
 TableCell
public class DataControlFieldCell extends TableCell
public class DataControlFieldCell extends
 TableCell
解説解説

DataControlFieldCell クラスは、GridViewDetailsView のように内容を表形式レイアウト表示する ASP.NET データ バインド コントロール内のセルを表す、厳密に指定された TableCell クラスです。

DataControlFieldCell オブジェクト格納する DataControlField オブジェクトは、セルスタイル適用してセル表示方法制御しますDataControlField オブジェクトアクセスするには、ContainingField プロパティ使用します

使用例使用例

DataControlField から派生するクラスで、DataControlFieldCell オブジェクト使用および操作するコード例次に示しますRadioButtonField クラスは、RadioButton コントロールを InitializeCell メソッド内のDataControlFieldCell オブジェクト追加し後で ExtractValuesFromCell メソッド内の RadioButton コントロールの値を確認します。このコード例は、DataControlField クラストピック取り上げているコード例一部分です。

' 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 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 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
.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.DataControlFieldHeaderCell
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataControlFieldCell メンバ
System.Web.UI.WebControls 名前空間
DataControlField クラス
DataControlFieldHeaderCell



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

辞書ショートカット

すべての辞書の索引

「DataControlFieldCell クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS