[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-devel-list
Subject: [Mono-dev] Bug in System.Web.UI/SclientScriptManager
From: "Vladimir Krasnov" <vladimirk () mainsoft ! com>
Date: 2007-01-29 12:56:13
Message-ID: DA63C6E8B207E748B20D46DFED7B772D03B7F468 () dhost002-45 ! dex002 ! intermedia ! net
[Download RAW message or body]
Hello
Please approve attached patch that fixes bug in
System.Web.UI/SclientScriptManager where webform.js and callback.js
scripts were always rendered, even within an empty form.
Vladimir
["Page.cs.patch" (application/octet-stream)]
Index: Page.cs
===================================================================
--- Page.cs (revision 71850)
+++ Page.cs (working copy)
@@ -1009,9 +1009,6 @@
RenderPostBackScript (writer, formUniqueID);
postBackScriptRendered = true;
}
-#if NET_2_0
- scriptManager.RegisterWebFormClientScript ();
-#endif
scriptManager.WriteClientScriptIncludes (writer);
scriptManager.WriteClientScriptBlocks (writer);
}
@@ -1038,6 +1035,7 @@
scriptManager.WriteExpandoAttributes (writer);
#endif
scriptManager.WriteHiddenFields (writer);
+ scriptManager.WriteClientScriptIncludes (writer);
scriptManager.WriteStartupScriptBlocks (writer);
renderingForm = false;
postBackScriptRendered = false;
["ClientScriptManager.cs.patch" (application/octet-stream)]
Index: ClientScriptManager.cs
===================================================================
--- ClientScriptManager.cs (revision 71850)
+++ ClientScriptManager.cs (working copy)
@@ -144,7 +144,10 @@
if (options.ClientSubmit || options.ActionUrl != null)
page.RequiresPostBackScript ();
-
+
+ if (!IsClientScriptIncludeRegistered (typeof (Page), "webform"))
+ RegisterClientScriptInclude (typeof (Page), "webform", GetWebResourceUrl (typeof \
(Page), "webform.js")); +
return String.Format ("{0}WebForm_DoPostback({1},{2},{3},{4},{5},{6},{7},{8})",
options.RequiresJavaScriptProtocol ? "javascript:" : "",
ClientScriptManager.GetScriptLiteral (options.TargetControl.UniqueID),
@@ -158,15 +161,6 @@
);
}
- internal void RegisterWebFormClientScript ()
- {
- if (!IsClientScriptIncludeRegistered (typeof (Page), "webform"))
- RegisterClientScriptInclude (typeof (Page), "webform", GetWebResourceUrl (typeof \
(Page), "webform.js"));
-
- if (!IsClientScriptIncludeRegistered (typeof (Page), "callback"))
- RegisterClientScriptInclude (typeof (Page), "callback", GetWebResourceUrl \
(typeof (Page), "callback.js"));
- }
-
public string GetCallbackEventReference (Control control, string argument, string \
clientCallback, string context) {
return GetCallbackEventReference (control, argument, clientCallback, context, \
null, false); @@ -190,7 +184,10 @@
public string GetCallbackEventReference (string target, string argument, string \
clientCallback, string context, string clientErrorCallback, bool useAsync) {
page.RequiresPostBackScript ();
-
+
+ if (!IsClientScriptIncludeRegistered (typeof (Page), "callback"))
+ RegisterClientScriptInclude (typeof (Page), "callback", GetWebResourceUrl \
(typeof (Page), "callback.js")); +
return string.Format ("WebForm_DoCallback('{0}',{1},{2},{3},{4},{5})", target, \
argument, clientCallback, context, ((clientErrorCallback == null) ? "null" : \
clientErrorCallback), (useAsync ? "true" : "false")); }
#endif
@@ -527,7 +524,10 @@
{
ScriptEntry entry = scriptIncludes;
while (entry != null) {
- writer.WriteLine ("\n<script src=\"{0}\" type=\"text/javascript\"></script>", \
entry.Script); + if (!entry.Rendered) {
+ writer.WriteLine ("\n<script src=\"{0}\" type=\"text/javascript\"></script>", \
entry.Script); + entry.Rendered = true;
+ }
entry = entry.Next;
}
}
@@ -616,6 +616,7 @@
public string Key;
public string Script;
public ScriptEntry Next;
+ public bool Rendered;
public ScriptEntry (Type type, string key, string script)
{
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic