Update of /cvsroot/magicajax/magicajax/Core/UI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7185/magicajax/Core/UI
Modified Files:
RenderedByScriptControl.cs
Log Message:
Fix for reflecting validator array declaration only once.
Index: RenderedByScriptControl.cs
===================================================================
RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** RenderedByScriptControl.cs 24 Jan 2006 22:25:05 -0000 1.22
--- RenderedByScriptControl.cs 6 Feb 2006 13:20:47 -0000 1.23
***************
*** 208,211 ****
--- 208,217 ----
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));
+
+ // Keep track of last Ajax control, so we can run some additional code after rendering the last Ajax control
+ if (!HttpContext.Current.Items.Contains("__LAST_AJAX_CONTROL"))
+ HttpContext.Current.Items.Add("__LAST_AJAX_CONTROL", this.ClientID);
+ else
+ HttpContext.Current.Items["__LAST_AJAX_CONTROL"] = this.ClientID;
}
***************
*** 268,271 ****
--- 274,305 ----
}
+ if (this.MagicAjaxContext.IsBrowserSupported && !IsChildOfRenderedByScriptControl(this))
+ {
+ if ((string)HttpContext.Current.Items["__LAST_AJAX_CONTROL"] == this.ClientID)
+ {
+ // This is the last Ajax control.
+ // Reflect added startup-scripts and arrays AFTER reflecting the controls HTML
+ if (MagicAjaxContext.Current.IsAjaxCall)
+ {
+ AjaxCallHelper.HandleArrayDeclares(this.Page, true);
+ AjaxCallHelper.HandleClientStartupScripts(this.Page, true);
+
+ // Store scriptblock fingerprints in hidden field
+ string allScriptFPs = string.Join(";", (string[])AjaxCallHelper._currentScriptFPs.ToArray(typeof(string)));
+ if (HttpContext.Current.Request.Form["__MAGICAJAX_SCRIPT_FINGERPRINTS"] != allScriptFPs)
+ AjaxCallHelper.WriteSetFieldScript("__MAGICAJAX_SCRIPT_FINGERPRINTS", allScriptFPs);
+ }
+ else
+ {
+ // Normal request (i.e. first page request)
+ AjaxCallHelper.HandleArrayDeclares(this.Page, false);
+ AjaxCallHelper.HandleClientStartupScripts(this.Page, false);
+
+ // Fill hidden field __MAGICAJAX_SCRIPT_FINGERPRINTS using script
+ writer.WriteLine("<script type=\"text/javascript\">AJAXCbo.SetField(\"__MAGICAJAX_SCRIPT_FINGERPRINTS\",{0});</script>", AjaxCallHelper.EncodeString(string.Join(";", (string[])AjaxCallHelper._currentScriptFPs.ToArray(typeof(string)))));
+ }
+ }
+ }
+
OnRenderEnd(EventArgs.Empty);
}
|