DataControlField.InitializeCell メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataControlField.InitializeCell メソッドの意味・解説 

DataControlField.InitializeCell メソッド

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

セルコントロールコレクションテキストまたはコントロール追加します

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

Public Overridable Sub InitializeCell
 ( _
    cell As DataControlFieldCell, _
    cellType As DataControlCellType, _
    rowState As DataControlRowState, _
    rowIndex As Integer _
)
Dim instance As DataControlField
Dim cell As DataControlFieldCell
Dim cellType As DataControlCellType
Dim rowState As DataControlRowState
Dim rowIndex As Integer

instance.InitializeCell(cell, cellType, rowState, rowIndex)
public virtual void InitializeCell (
    DataControlFieldCell cell,
    DataControlCellType cellType,
    DataControlRowState rowState,
    int rowIndex
)
public:
virtual void InitializeCell (
    DataControlFieldCell^ cell, 
    DataControlCellType cellType, 
    DataControlRowState rowState, 
    int rowIndex
)
public void InitializeCell (
    DataControlFieldCell cell, 
    DataControlCellType cellType, 
    DataControlRowState rowState, 
    int rowIndex
)
public function InitializeCell (
    cell : DataControlFieldCell, 
    cellType : DataControlCellType, 
    rowState : DataControlRowState, 
    rowIndex : int
)

パラメータ

cell

DataControlField のテキストまたはコントロール格納する DataControlFieldCell。

cellType

DataControlCellType 値の 1 つ

rowState

DataControlRowState 値の 1 つDataControlFieldCell格納する行の状態を示します

rowIndex

DataControlFieldCell を含む行のインデックス

解説解説
使用例使用例

DataControlField クラスから派生したコントロールInitializeCell メソッド実装する方法次のコード例示しますRadioButtonField クラスは、GridView コントロール各行データ バインド オプション ボタン表示します。行がデータ表示していて、さらに編集モードない場合RadioButton コントロール無効になりますユーザーGridView コントロール内の行の更新選択した場合のように行が編集モード場合RadioButton コントロール有効化されて表示されクリックできるようになります。この例ではビットごとの AND 演算子を使用してます。これは、行の状態が 1 つ上の DataControlRowState 値の組み合わせで決まるからです。

' 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
// 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);
}
// 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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataControlField クラス
DataControlField メンバ
System.Web.UI.WebControls 名前空間
ExtractValuesFromCell


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataControlField.InitializeCell メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataControlField.InitializeCell メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataControlField.InitializeCell メソッド を検索

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

辞書ショートカット

すべての辞書の索引

DataControlField.InitializeCell メソッドのお隣キーワード
検索ランキング

   

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



DataControlField.InitializeCell メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS