From: Argiris K. <be...@us...> - 2005-11-17 15:03:25
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23052/Core/UI/Controls Modified Files: AjaxPanel.cs Log Message: Server.Transfer is working for 'NoStore' mode. Exceptions thrown during page processing are handled properly. Improvements for 'Storing' page modes (NoVerifyRenderingPage is not required) Fixed various problems that RBS_Control_Store was causing. Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/Controls/AjaxPanel.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AjaxPanel.cs 16 Nov 2005 13:39:14 -0000 1.8 --- AjaxPanel.cs 17 Nov 2005 15:03:16 -0000 1.9 *************** *** 84,89 **** private Hashtable _controlHtmls = new Hashtable(); private Hashtable _controlHtmlHashes = new Hashtable(); ! private NoVerifyRenderingPage _noVerifyPage = new NoVerifyRenderingPage(); ! private ControlCollectionState _controlState = new ControlCollectionState(); #endregion --- 84,88 ---- private Hashtable _controlHtmls = new Hashtable(); private Hashtable _controlHtmlHashes = new Hashtable(); ! private ControlCollectionState _controlState; #endregion *************** *** 99,102 **** --- 98,102 ---- public AjaxPanel() : base(HtmlTextWriterTag.Span) { + _controlState = new ControlCollectionState(this); } #endregion *************** *** 174,179 **** return; - DisableVerifyRendering (true); - System.Text.StringBuilder sb = new System.Text.StringBuilder(); HtmlTextWriter litewriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); --- 174,177 ---- *************** *** 192,197 **** sb.Length = 0; } - - DisableVerifyRendering (false); } #endregion --- 190,193 ---- *************** *** 221,227 **** base.OnLoad (e); - // Enable validation if there is at least one validator. - _noVerifyPage.EnableValidation = (Page.Validators.Count > 0); - if (this.Attributes["AjaxCall"] == null) { --- 217,220 ---- *************** *** 273,277 **** protected override void RenderChildren(HtmlTextWriter writer) { ! if ( AjaxCallHelper.IsAjaxCall && IsPageNoStoreMode ) { LoadControlState(); --- 266,270 ---- protected override void RenderChildren(HtmlTextWriter writer) { ! if ( IsAjaxCall && IsPageNoStoreMode ) { LoadControlState(); *************** *** 280,285 **** else { - DisableVerifyRendering (true); - System.Text.StringBuilder sbFull = new System.Text.StringBuilder(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); --- 273,276 ---- *************** *** 309,314 **** } - DisableVerifyRendering (false); - _addedControls.Clear(); _removedControls.Clear(); --- 300,303 ---- *************** *** 329,333 **** protected virtual void LoadControlState() { ! _controlState = ControlCollectionState.LoadState (this.UniqueID); if (_controlState == null) --- 318,322 ---- protected virtual void LoadControlState() { ! _controlState = ControlCollectionState.LoadState (this.UniqueID, this); if (_controlState == null) *************** *** 392,396 **** protected virtual void DoScriptRendering (HtmlTextWriter output) { ! DisableVerifyRendering (true); System.Text.StringBuilder sb = new System.Text.StringBuilder(); --- 381,386 ---- protected virtual void DoScriptRendering (HtmlTextWriter output) { ! if ( IsAjaxCall && !IsPageNoStoreMode ) ! InitValidators(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); *************** *** 499,504 **** } - DisableVerifyRendering (false); - _addedControls.Clear(); _removedControls.Clear(); --- 489,492 ---- *************** *** 626,680 **** #endregion ! #region DisableVerifyRendering /// <summary> ! /// Disables the verify rendering in server form check. /// </summary> ! /// <remarks> ! /// It disables the verify rendering in server form check of the controls by ! /// setting NoVerifyRenderingPage to their Page property. It enables it again ! /// by setting back the Page of AjaxPanel. ! /// ! /// See the remarks of the NoVerifyRenderingPage class. ! /// </remarks> ! /// <param name="disable">True to set the NoVerifyRenderingPage, false to set the previous page back</param> ! private void DisableVerifyRendering(bool disable) { ! // NoVerifyRenderingPage is used even during normal rendering, ! // so that ':' is used for Unique ID separator instead of '$', ! // thus javascript to convert the Unique IDs of the page won't be sent ! // at the first AjaxCall. ! ! // Try not using DisableVerify at all if it's IsPageNoStoreMode ! if ( this.IsPageNoStoreMode ) ! return; ! ! Page page = (disable) ? _noVerifyPage : this.Page; ! for (int i=0; i < Controls.Count; i++) { ! SetPageForControl(page, Controls[i]); } - } - #endregion - #region SetPageForControl - /// <summary> - /// Sets the supplied page to the Page property of the supplied control and - /// its children. - /// </summary> - /// <remarks> - /// If it encounters a RenderedByScriptControl control, it ignores it. - /// - /// Called by DisableVerifyRendering. - /// </remarks> - /// <param name="page"></param> - /// <param name="control"></param> - private void SetPageForControl(Page page, Control control) - { - if (!(control is RenderedByScriptControl)) - { - control.Page = page; - for (int i=0; i < control.Controls.Count; i++) - SetPageForControl (page, control.Controls[i]); - } } #endregion --- 614,630 ---- #endregion ! #region InitValidators /// <summary> ! /// Clears 'display' and 'visibility' styles from all the validators. /// </summary> ! private void InitValidators() { ! ArrayList valids = Util.GetChildControlsOfType(this, typeof(BaseValidator), true); ! foreach (BaseValidator valid in valids) { ! valid.Style.Remove("display"); ! valid.Style.Remove("visibility"); } } #endregion *************** *** 777,786 **** { private SortedList _controlIDHtmlHashes; /// <summary> /// Default ctor /// </summary> ! public ControlCollectionState() { _controlIDHtmlHashes = new SortedList(); } --- 727,738 ---- { private SortedList _controlIDHtmlHashes; + private Control _owner; /// <summary> /// Default ctor /// </summary> ! public ControlCollectionState(Control owner) { + _owner = owner; _controlIDHtmlHashes = new SortedList(); } *************** *** 790,795 **** /// </summary> /// <param name="controlIDHtmlHashes"></param> ! public ControlCollectionState(SortedList controlIDHtmlHashes) { _controlIDHtmlHashes = controlIDHtmlHashes; } --- 742,748 ---- /// </summary> /// <param name="controlIDHtmlHashes"></param> ! public ControlCollectionState(SortedList controlIDHtmlHashes, Control owner) { + _owner = owner; _controlIDHtmlHashes = controlIDHtmlHashes; } *************** *** 800,804 **** /// <param name="panelUniqueID"></param> /// <returns></returns> ! public static ControlCollectionState LoadState(string panelUniqueID) { string panelKey = GetPanelControlStateHiddenFieldID(panelUniqueID); --- 753,757 ---- /// <param name="panelUniqueID"></param> /// <returns></returns> ! public static ControlCollectionState LoadState(string panelUniqueID, Control owner) { string panelKey = GetPanelControlStateHiddenFieldID(panelUniqueID); *************** *** 815,819 **** } ! return new ControlCollectionState(controlIDHtmlHashes); } else --- 768,772 ---- } ! return new ControlCollectionState(controlIDHtmlHashes, owner); } else *************** *** 870,874 **** string panelKey = GetPanelControlStateHiddenFieldID(panelUniqueID); ! if (AjaxCallHelper.IsAjaxCall) { //if ajax callback, generate javascript to set panelstate's hidden field value --- 823,827 ---- string panelKey = GetPanelControlStateHiddenFieldID(panelUniqueID); ! if ( AjaxCallHelper.IsAjaxCallForPage(_owner.Page) ) { //if ajax callback, generate javascript to set panelstate's hidden field value |