DataControlField.ExtractValuesFromCell メソッド
アセンブリ: System.Web (system.web.dll 内)

Public Overridable Sub ExtractValuesFromCell ( _ dictionary As IOrderedDictionary, _ cell As DataControlFieldCell, _ rowState As DataControlRowState, _ includeReadOnly As Boolean _ )
Dim instance As DataControlField Dim dictionary As IOrderedDictionary Dim cell As DataControlFieldCell Dim rowState As DataControlRowState Dim includeReadOnly As Boolean instance.ExtractValuesFromCell(dictionary, cell, rowState, includeReadOnly)
public virtual void ExtractValuesFromCell ( IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly )
public: virtual void ExtractValuesFromCell ( IOrderedDictionary^ dictionary, DataControlFieldCell^ cell, DataControlRowState rowState, bool includeReadOnly )
public void ExtractValuesFromCell ( IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, boolean includeReadOnly )
public function ExtractValuesFromCell ( dictionary : IOrderedDictionary, cell : DataControlFieldCell, rowState : DataControlRowState, includeReadOnly : boolean )
- dictionary
IOrderedDictionary。
- rowState
DataControlRowState 値の 1 つ。

ExtractValuesFromCell メソッドは、DataControlField から派生した型によって実装され、現在のフィールドと値を関連付けられる場合は関連付けます。フィールドと値の組み合わせは、メソッドに渡される dictionary コレクション内に格納されます。ExtractValuesFromCell メソッドは、DetailsView や GridView などのデータ コントロールの ExtractRowValues メソッドにより呼び出されます。
DataControlFieldCell オブジェクトを使用してセルとそれらのセルに関連付けられた値のセットをアセンブルするカスタム データ バインド コントロールを記述する場合は、このメソッドを呼び出します。ユーザー データまたはデータ バインド データを表示する DataControlField から派生するクラスを記述する場合は、このメソッドを実装します。ユーザー データを表示しないフィールドもあるので、すべての派生型が ExtractValuesFromCell メソッドを実装するわけではありません。たとえば、ButtonField コントロールは、ユーザー データを表示せず、ボタンだけを表示します。

DataControlField クラスから派生したコントロールの ExtractValuesFromCell メソッドを実装する方法を次のコード例に示します。RadioButtonField クラスは、GridView コントロールの各行にデータ バインド オプション ボタンを表示します。ExtractValuesFromCell メソッドを呼び出すと、このメソッドは、セルに格納された RadioButton オブジェクトの現在の値が選択されているかまたは選択解除されているかを確認して、その値を IDictionary コレクションに追加します。このコード例は、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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDataControlField.ExtractValuesFromCell メソッドを検索する場合は、下記のリンクをクリックしてください。

- DataControlField.ExtractValuesFromCell メソッドのページへのリンク