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


Parameter オブジェクトが ParameterCollection コレクションに含まれていない場合、OnParameterChanged メソッドの呼び出しは無効になります。Parameter オブジェクトが ParameterCollection コレクションに含まれている場合には、OnParameterChanged はコレクションの ParameterCollection.ParametersChanged イベントを発生させます。
ParameterCollection コレクションがデータ ソース コントロールに格納されている場合、ParameterCollection.ParametersChanged イベントは、そのデータ ソース コントロールの System.Web.UI.IDataSource.DataSourceChanged イベントを発生させます。これにより、データ バインド コントロールが再バインドします。
イベントが発生すると、デリゲートを使用してイベント ハンドラが呼び出されます。詳細については、「イベントの発生」を参照してください。
OnParameterChanged メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。派生クラスでイベントを処理する場合は、この手法をお勧めします。
継承時の注意 派生クラスで OnParameterChanged をオーバーライドする場合は、登録されているデリゲートがイベントを受け取ることができるように、基本クラスの OnParameterChanged メソッドを呼び出してください。
パラメータの状態が変更されたときに、OnParameterChanged メソッドを呼び出して ParametersChanged イベントを発生させる方法を次のコード例に示します。このコード例は Parameter クラスの概要で取り上げているコード例の一部分です。
' The Value property is a type safe convenience property ' used when the StaticParameter represents string data. ' It gets the string value of the DataValue property, and ' sets the DataValue property directly. Public Property Value() As String Get Dim o As Object = DataValue If o Is Nothing OrElse Not TypeOf o Is String Then Return String.Empty End If Return CStr(o) End Get Set DataValue = value OnParameterChanged() End Set End Property
// The Value property is a type safe convenience property // used when the StaticParameter represents string data. // It gets the string value of the DataValue property, and // sets the DataValue property directly. public string Value { get { object o = DataValue; if (o == null || !(o is string)) return String.Empty; return (string)o; } set { DataValue = value; OnParameterChanged(); } }
// The Value property is a type safe convenience property // used when the StaticParameter represents string data. // It gets the string value of the DataValue property, and // sets the DataValue property directly. /** @property */ public String get_Value() { Object o = get_DataValue(); if (o == null || !(o instanceof String)) { return String.Empty; } return (String)(o); } //get_Value /** @property */ public void set_Value(String value) { set_DataValue(value); OnParameterChanged(); } //set_Value

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Parameter.OnParameterChanged メソッドのページへのリンク