From: Argiris K. <be...@us...> - 2005-11-23 19:34:32
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2430/Core/UI Modified Files: RenderedByScriptControl.cs Log Message: Tracing reuses the same trace window. Replaced keeping/restoring the page's form html with the previous implementation of RBS_Control_Stores. Some corrections to allow compilation for NET 1.1 and CustomControls. Index: RenderedByScriptControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RenderedByScriptControl.cs 22 Nov 2005 00:59:22 -0000 1.11 --- RenderedByScriptControl.cs 23 Nov 2005 19:34:23 -0000 1.12 *************** *** 182,185 **** --- 182,226 ---- } + protected override void OnLoad(EventArgs e) + { + base.OnLoad (e); + + if (!IsChildOfRenderedByScriptControl(this)) + { + string hiddenStore; + + if ( IsPageNoStoreMode ) + { + // Firefox, when performing a refresh, loads the page but keeps any INPUT + // field values. Thus, the html of a RenderedByScriptControl is restored + // as if the page was loaded because of the browser's "Back Button". + // We cannot avoid this because Firefox also keeps any changes that occured + // to ViewState, so we need the controls to keep their changes. + hiddenStore = this.ClientID + "$RBS_Store"; + } + else + { + // At storing modes we don't mess with the ViewState field, so use + // a different name for the hidden field at each page request so that + // it can be reset for Firefox's "Refresh". + hiddenStore = this.ClientID + "$RBS_Store" + DateTime.Now.Ticks; + } + + Page.RegisterHiddenField(hiddenStore, null); + Page.RegisterArrayDeclaration("RBS_Controls", String.Format("document.getElementById(\"{0}$RBS_Holder\")", this.ClientID)); + Page.RegisterArrayDeclaration("RBS_Controls_Store", String.Format("document.forms[0][\"{0}\"]", hiddenStore)); + } + } + + protected bool IsChildOfRenderedByScriptControl(Control control) + { + if (control.Parent == null || control.Parent == control.Page) + return false; + else if (control.Parent is RenderedByScriptControl) + return true; + else + return IsChildOfRenderedByScriptControl(control.Parent); + } + protected override void OnAjaxCall(EventArgs e) { *************** *** 206,210 **** if ( !IsAjaxCall || (writer.InnerWriter is IScriptRenderingDisabler && (writer.InnerWriter as IScriptRenderingDisabler).DisableScriptRendering) ) { ! base.Render (writer); _isHtmlRendered = true; --- 247,261 ---- if ( !IsAjaxCall || (writer.InnerWriter is IScriptRenderingDisabler && (writer.InnerWriter as IScriptRenderingDisabler).DisableScriptRendering) ) { ! if ( !IsChildOfRenderedByScriptControl(this) ) ! { ! // Put the html of this control inside a SPAN tag so that it can ! // be saved and restored when the page is loaded from the Browser's cache, ! // i.e. when the back button is pressed. ! writer.Write("<span id='{0}$RBS_Holder'>", this.ClientID); ! base.Render (writer); ! writer.Write("</span>"); ! } ! else ! base.Render (writer); _isHtmlRendered = true; |