Update of /cvsroot/magicajax/magicajax/Core/UI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20348/magicajax/Core/UI
Modified Files:
RenderedByScriptControl.cs
Log Message:
Firefox keeps the form data of a page when doing a page reload or using
the back/forward button.
However, the 'RenderedByScriptControls' will disappear after a reload.
To redraw these controls on the page, we will force a callback from the client's
window.onload when the value of hidden field '__RBSCONTROLSEXIST'
equals '1'. This hidden field is set to '1' whenever a callback is made.
On first page rendering, the value of this hidden field is '0'.
Internet Explorer always resets all form data on a page refresh (also the hidden
field '__RBSCONTROLSEXIST'), so for IE no extra callback will be forced.
Index: RenderedByScriptControl.cs
===================================================================
RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RenderedByScriptControl.cs 14 Nov 2005 18:50:43 -0000 1.2
--- RenderedByScriptControl.cs 16 Nov 2005 22:54:31 -0000 1.3
***************
*** 173,189 ****
protected override void OnPreRender(EventArgs e)
{
! if ( ! IsChildOfRenderedByScriptControl(this) )
{
! // 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".
! // To resolve this, the name of the storing fields is different for
! // each page request.
! string hiddenStore = this.ClientID + "$RBS_Store" + DateTime.Now.Ticks;
! Page.RegisterHiddenField(hiddenStore, null);
! Page.RegisterArrayDeclaration("RBS_Controls", String.Format("document.all[\"{0}$RBS_Holder\"]", this.ClientID));
! Page.RegisterArrayDeclaration("RBS_Controls_Store", String.Format("document.all[\"{0}\"]", hiddenStore));
}
-
base.OnPreRender (e);
}
--- 173,204 ----
protected override void OnPreRender(EventArgs e)
{
! if (!IsChildOfRenderedByScriptControl(this))
{
! if (IsPageNoStoreMode)
! {
! // Firefox keeps the form data of a page when doing a page reload or using
! // the back/forward button.
! // However, the 'RenderedByScriptControls' will disappear after a reload.
! // To redraw these controls on the page, we will force a callback from the client's
! // window.onload when the value of hidden field '__RBSCONTROLSEXIST'
! // equals '1'. This hidden field is set to '1' whenever a callback is made.
! // On first page rendering, the value of this hidden field is '0'.
! // Internet Explorer always resets all form data on a page refresh (also the hidden
! // field '__RBSCONTROLSEXIST'), so for IE no extra callback will be forced.
! Page.RegisterHiddenField("__RBSCONTROLSEXIST", "0");
! }
! else
! {
! // 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".
! // To resolve this, the name of the storing fields is different for
! // each page request.
! string hiddenStore = this.ClientID + "$RBS_Store" + DateTime.Now.Ticks;
! Page.RegisterHiddenField(hiddenStore, null);
! Page.RegisterArrayDeclaration("RBS_Controls", String.Format("document.all[\"{0}$RBS_Holder\"]", this.ClientID));
! Page.RegisterArrayDeclaration("RBS_Controls_Store", String.Format("document.all[\"{0}\"]", hiddenStore));
! }
}
base.OnPreRender (e);
}
|