チェンジセット 1666 (default)


以下の違いを無視:
日時:
2024/08/28 19:10:48 (6週前)
更新者:
hizuya@…
ログメッセージ:
  • Inserted, Deleted でビューモードを変更しない場合、自動的なデータバインディングを抑制する仕組みを追加。
ファイル:
1個の更新

凡例:

未変更
追加
削除
  • framework/trunk/WebLibrary/Sources/UI/WebControls/FormView.cs

    r1603 r1666  
    2222namespace FCSoft.SilverFrost.Framework.Web.UI.WebControls 
    2323{ 
     24    using System.ComponentModel; 
     25    using System.Web.UI; 
     26    using System.Web.UI.WebControls; 
     27 
     28 
    2429    /// <summary> 
    2530    /// グリッド表示を行うためのコントロールです。 
     
    3136    { 
    3237        /// <summary> 
     38        /// <see cref="CancelAutomaticDataBindingWhenKeepMode"/> プロパティ用のキー。 
     39        /// </summary> 
     40        private const string CancelAutomaticDataBindingWhenKeepModeKey = "CancelAutomaticDataBindingWhenKeepMode"; 
     41 
     42 
     43        /// <summary> 
    3344        /// インスタンスを作成します。 
    3445        /// </summary> 
     
    3748            ControlInitializer.ApplyProperties(this); 
    3849        } 
     50 
     51 
     52        /// <summary> 
     53        /// <see cref="System.Web.UI.WebControls.FormView.ItemInserted"/> イベントまたは 
     54        /// <see cref="System.Web.UI.WebControls.FormView.ItemUpdated"/> イベントで 
     55        /// ビューモードが維持された場合に、自動的なデータバインディングを抑制するかどうかを取得または設定します。 
     56        /// </summary> 
     57        /// <value> 
     58        /// ビューモードが維持された場合に、自動的なデータバインディングを抑制する場合は <see langword="true"/>。 
     59        /// それ以外の場合は <see langword="false"/>。 
     60        /// 既定値は空の <see langword="false"/>。 
     61        /// </value> 
     62        [Themeable(false)] 
     63        [DefaultValue(false)] 
     64        [WebCategory("Data")] 
     65        [WebDescription("Description_FormView_CancelAutomaticDataBindingWhenKeepMode")] 
     66        public virtual bool CancelAutomaticDataBindingWhenKeepMode 
     67        { 
     68            get 
     69            { 
     70                return (bool)(ViewState[CancelAutomaticDataBindingWhenKeepModeKey] ?? false); 
     71            } 
     72 
     73            set 
     74            { 
     75                ViewState[CancelAutomaticDataBindingWhenKeepModeKey] = value; 
     76            } 
     77        } 
     78 
     79 
     80        /// <summary> 
     81        /// <see cref="System.Web.UI.WebControls.FormView.ItemInserted" /> イベントを発生させます。 
     82        /// </summary> 
     83        /// <param name="e">イベント データを格納している <see cref="FormViewInsertedEventArgs" />。</param> 
     84        protected override void OnItemInserted(FormViewInsertedEventArgs e) 
     85        { 
     86            // 親を呼び出す 
     87            base.OnItemInserted(e); 
     88 
     89            if (e.KeepInInsertMode && CancelAutomaticDataBindingWhenKeepMode) 
     90            { 
     91                RequiresDataBinding = false; 
     92            } 
     93        } 
     94 
     95        /// <summary> 
     96        /// <see cref="System.Web.UI.WebControls.FormView.ItemUpdated" /> イベントを発生させます。</summary> 
     97        /// <param name="e">イベント データを格納している <see cref="FormViewUpdatedEventArgs" />。</param> 
     98        protected override void OnItemUpdated(FormViewUpdatedEventArgs e) 
     99        { 
     100            // 親を呼び出す 
     101            base.OnItemUpdated(e); 
     102 
     103            if (e.KeepInEditMode && CancelAutomaticDataBindingWhenKeepMode) 
     104            { 
     105                RequiresDataBinding = false; 
     106            } 
     107        } 
    39108    } 
    40109} 
詳しい使い方は TracChangeset を参照してください。