Author: igorz
Date: 2008-01-03 03:58:29 -0500 (Thu, 03 Jan 2008)
New Revision: 92159

Modified:
   trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs
Log:
encode ExpandoAttribute if need.

Modified: trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs
===================================================================
--- trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs        
2008-01-03 08:33:07 UTC (rev 92158)
+++ trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs        
2008-01-03 08:58:29 UTC (rev 92159)
@@ -1259,8 +1259,17 @@
                        if (_expandoAttributes != null) {
                                for (int i = 0; i < _expandoAttributes.Count; 
i++) {
                                        RegisteredExpandoAttribute attr = 
_expandoAttributes [i];
-                                       if (HasBeenRendered (attr.Control))
-                                               WriteCallbackOutput (writer, 
expando, "document.getElementById('Label2')['" + attr.Name + "']", "\"" + 
attr.Value + "\"");
+                                       if (HasBeenRendered (attr.Control)) {
+                                               string value;
+                                               if (attr.Encode) {
+                                                       StringWriter sw = new 
StringWriter ();
+                                                       
Newtonsoft.Json.JavaScriptUtils.WriteEscapedJavaScriptString (attr.Value, sw);
+                                                       value = sw.ToString ();
+                                               }
+                                               else
+                                                       value = "\"" + 
attr.Value + "\"";
+                                               WriteCallbackOutput (writer, 
expando, "document.getElementById('Label2')['" + attr.Name + "']", value);
+                                       }
                                }
                        }
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to