Browse Source

2007-11-13 Igor Zelmanovich <[email protected]>

	* ClientScriptManager.cs: 
	Ensure a script resource is included once in multi form environment.


svn path=/trunk/mcs/; revision=89561
Igor Zelmanovich 18 years ago
parent
commit
0526507069

+ 5 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,8 @@
+2007-11-13 Igor Zelmanovich <[email protected]>
+
+	* ClientScriptManager.cs: 
+	Ensure a script resource is included once in multi form environment.
+
 2007-11-07 Igor Zelmanovich <[email protected]>
 
 	* PageParser.cs: fixed initial value of tracemode.

+ 4 - 4
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs

@@ -194,7 +194,7 @@ namespace System.Web.UI
 		internal void WriteWebFormClientScript (HtmlTextWriter writer) {
 			if (!_webFormClientScriptRendered && _webFormClientScriptRequired) {
 				writer.WriteLine ();
-				WriteClientScriptInclude (writer, GetWebResourceUrl (typeof (Page), "webform.js"));
+				WriteClientScriptInclude (writer, GetWebResourceUrl (typeof (Page), "webform.js"), typeof (Page), "webform.js");
 				WriteBeginScriptBlock (writer);
 				writer.WriteLine ("WebForm_Initialize({0});", page.IsMultiForm ? page.theForm : "window");
 				WriteEndScriptBlock (writer);
@@ -531,7 +531,7 @@ namespace System.Web.UI
 					break;
 				case ScriptEntryFormat.Include:
 					EnsureEndScriptBlock (writer);
-					WriteClientScriptInclude (writer, scriptList.Script);
+					WriteClientScriptInclude (writer, scriptList.Script, scriptList.Type, scriptList.Key);
 					break;
 				default:
 					EnsureEndScriptBlock (writer);
@@ -654,11 +654,11 @@ namespace System.Web.UI
 			hiddenFields = null;
 		}
 		
-		internal void WriteClientScriptInclude (HtmlTextWriter writer, string path) {
+		internal void WriteClientScriptInclude (HtmlTextWriter writer, string path, Type type, string key) {
 					if (!page.IsMultiForm)
 						writer.WriteLine ("<script src=\"{0}\" type=\"text/javascript\"></script>", path);
 					else {
-						string scriptKey = "inc_" + path.GetHashCode ().ToString ("X");
+						string scriptKey = "inc_" + (type.FullName + key).GetHashCode ().ToString ("X");
 						writer.WriteLine ("<script type=\"text/javascript\">");
 						writer.WriteLine (SCRIPT_BLOCK_START);
 						writer.WriteLine ("if (document.{0} == null) {{", scriptKey);