2007-12-13 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 13 Dec 2007 13:50:10 +0000 (13:50 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 13 Dec 2007 13:50:10 +0000 (13:50 -0000)
* ClientScriptManager.cs, MasterPageParser.cs, Control.cs,
Page.cs: speed optimization - use String.Concat instead of
String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* Menu.cs, TreeView.cs: optimize use of String.Format in
OnPreRender.
Speed optimization - use String.Concat instead of String.Format in
some cases.

* GridView.cs, DetailsView.cs: optimize use of String.Format in
OnPreRender.

* CheckBox.cs, AccessDataSource.cs, WebColorConverter.cs,
WebControl.cs,TextBox.cs, DropDownList.cs, ValidationSummary.cs,
ListBox.cs, Panel.cs, BaseValidator.cs, LinkButton.cs: speed
optimization - use String.Concat instead of String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* HtmlForm.cs, HtmlButton.cs: speed optimization - use String.Concat
instead of String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* AssemblyResourceLoader.cs: speed optimization - use String.Concat
instead of String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* SessionId.cs:
speed optimization - use String.Concat
instead of String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* SqlProfileProvider.cs, ProfileParser.cs: speed optimization -
use String.Concat instead of String.Format in some cases.
2007-12-13  Marek Habersack  <mhabersack@novell.com>

* ApplicationManager.cs, ApplicationHost.cs,
DefaultVirtualPathProvider.cs: speed optimization - use
String.Concat instead of String.Format in some cases.

svn path=/trunk/mcs/; revision=91230

35 files changed:
mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
mcs/class/System.Web/System.Web.Handlers/ChangeLog
mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
mcs/class/System.Web/System.Web.Hosting/ApplicationManager.cs
mcs/class/System.Web/System.Web.Hosting/ChangeLog
mcs/class/System.Web/System.Web.Hosting/DefaultVirtualPathProvider.cs
mcs/class/System.Web/System.Web.Profile/ChangeLog
mcs/class/System.Web/System.Web.Profile/ProfileParser.cs
mcs/class/System.Web/System.Web.Profile/SqlProfileProvider.cs
mcs/class/System.Web/System.Web.SessionState/ChangeLog
mcs/class/System.Web/System.Web.SessionState/SessionId.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs
mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs
mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
mcs/class/System.Web/System.Web.UI/Control.cs
mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
mcs/class/System.Web/System.Web.UI/Page.cs

index 985c2b76e691339cc33eead757d1aba59251912a..b1b7692dd3e32fe2335cd93c4d8a7160f0825cea 100644 (file)
@@ -126,14 +126,14 @@ namespace System.Web.Handlers {
                static string EncryptAssemblyResource (string asmName, string resName)
                {
                        byte[] key = GetEncryptionKey ();
-                       byte[] bytes = Encoding.UTF8.GetBytes (String.Format ("{0};{1}", asmName, resName));
+                       byte[] bytes = Encoding.UTF8.GetBytes (String.Concat (asmName, ";", resName));
                        string result;
                        
                        ICryptoTransform encryptor = TripleDES.Create ().CreateEncryptor (key, init_vector);
                        result = GetHexString (encryptor.TransformFinalBlock (bytes, 0, bytes.Length));
                        bytes = null;
 
-                       return String.Format ("d={0}", result.ToLower (CultureInfo.InvariantCulture));
+                       return String.Concat ("d=", result.ToLower (CultureInfo.InvariantCulture));
                }
 
                static void DecryptAssemblyResource (string val, out string asmName, out string resName)
@@ -186,17 +186,16 @@ namespace System.Web.Handlers {
                        string atime = String.Empty;
                        string extra = String.Empty;
 #if SYSTEM_WEB_EXTENSIONS
-                       extra = String.Format ("{0}n={1}", QueryParamSeparator, notifyScriptLoaded ? "t" : "f");
+                       extra = String.Concat (QueryParamSeparator, "n=", notifyScriptLoaded ? "t" : "f");
 #endif
 
 #if TARGET_JVM
                        atime = String.Format ("{0}t={1}", QueryParamSeparator, assembly.GetHashCode ());
 #else
                        if (apath != String.Empty)
-                               atime = String.Format ("{0}t={1}", QueryParamSeparator, File.GetLastWriteTimeUtc (apath).Ticks);
+                               atime = String.Concat (QueryParamSeparator, "t=", File.GetLastWriteTimeUtc (apath).Ticks);
 #endif
-                       string href = String.Format ("{0}?{1}{2}{3}", HandlerFileName,
-                                                    EncryptAssemblyResource (aname, resourceName), atime, extra);
+                       string href = HandlerFileName + "?" + EncryptAssemblyResource (aname, resourceName) + atime + extra;
 
                        HttpContext ctx = HttpContext.Current;
                        if (ctx != null && ctx.Request != null) {
@@ -248,7 +247,7 @@ namespace System.Web.Handlers {
                        }
 #endif
                        if (wra == null)
-                               throw new HttpException (404, string.Format ("Resource {0} not found", resourceName));
+                               throw new HttpException (404, String.Concat ("Resource ", resourceName, " not found"));
                        
                        context.Response.ContentType = wra.ContentType;
 
@@ -258,7 +257,7 @@ namespace System.Web.Handlers {
 
                        Stream s = assembly.GetManifestResourceStream (resourceName);
                        if (s == null)
-                               throw new HttpException (404, string.Format ("Resource {0} not found", resourceName));
+                               throw new HttpException (404, String.Concat ("Resource ", resourceName, " not found"));
 
                        if (wra.PerformSubstitution) {
                                StreamReader r = new StreamReader (s);
index ed5491209f4ddb4407f708eb954a27db7345ccb4..f39783efc06b9aa0667eb979440479762414af48 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * AssemblyResourceLoader.cs: speed optimization - use String.Concat
+       instead of String.Format in some cases.
+
 2007-11-12 Igor Zelmanovich <igorz@mainsoft.com>
 
        * AssemblyResourceLoader.cs:
index c3f8317e796e4a50e09322f1f840939f7357dafc..27a034085dac5db374690d2054ec56b036026b3b 100644 (file)
@@ -180,10 +180,10 @@ namespace System.Web.Hosting {
                        string dynamic_dir = null;
                        string user = Environment.UserName;
                        int tempDirTag = 0;
+                       string dirPrefix = String.Concat (user, "-temp-aspnet-");
                        
                        for (int i = 0; ; i++){
-                               string d = Path.Combine (Path.GetTempPath (),
-                                       String.Format ("{0}-temp-aspnet-{1:x}", user, i));
+                               string d = Path.Combine (Path.GetTempPath (), String.Concat (dirPrefix, i.ToString ("x")));
                        
                                try {
                                        CreateDirectory (d);
index 606e0306c02c3f22fcc2a209286047b9bdca537f..16d54aea7f4ca3ba5290615e5cf7e63718429953 100644 (file)
@@ -71,10 +71,8 @@ namespace System.Web.Hosting {
                                throw new ArgumentException ("Cannot be null or empty", "physicalPath");
 
                        // 'type' is not checked. If it's null, we'll throw a NullReferenceException
-                       if (!typeof (IRegisteredObject).IsAssignableFrom (type)) {
-                               string msg = String.Format ("Type '{0}' does not implement IRegisteredObject.", type.Name);
-                               throw new ArgumentException (msg, "type");
-                       }
+                       if (!typeof (IRegisteredObject).IsAssignableFrom (type))
+                               throw new ArgumentException (String.Concat ("Type '", type.Name, "' does not implement IRegisteredObject."), "type");
 
                        //
                        // ArgumentException is thrown for the physical path from the internal object created
@@ -135,11 +133,8 @@ namespace System.Web.Hosting {
                        if (ireg == null)
                                return null;
 
-                       if (failIfExists) {
-                               string msg = String.Format ("Well known object of type '{0}' already " +
-                                               "exists in this domain.", type.Name);
-                               throw new InvalidOperationException (msg);
-                       }
+                       if (failIfExists)
+                               throw new InvalidOperationException (String.Concat ("Well known object of type '", type.Name, "' already exists in this domain."));
 
                        return ireg;
                }
index 28ece460b698ea27f718db6cecc74533046cafdd..0901e9954a3a4b91617a6c244ecfcfb3d8502dff 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * ApplicationManager.cs, ApplicationHost.cs,
+       DefaultVirtualPathProvider.cs: speed optimization - use
+       String.Concat instead of String.Format in some cases.
+
 2007-11-03  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * ApplicationHost.cs: On 2.0, also make PrivateBinPath an absolute
index eecbcdb230587da5b8ef4174a1d3f6482fddb258..54d8837ae5c92c3d47d12798dc93aeb11f6df6fb 100644 (file)
@@ -57,10 +57,8 @@ namespace System.Web.Hosting {
                        if (virtualDir == null || virtualDir == "")
                                throw new ArgumentNullException ("virtualDir");
 
-                       if (UrlUtils.IsRelativeUrl (virtualDir)) {
-                               string msg = String.Format ("The relative virtual path '{0}', is not allowed here.", virtualDir);
-                               throw new ArgumentException (msg);
-                       }
+                       if (UrlUtils.IsRelativeUrl (virtualDir))
+                               throw new ArgumentException (String.Concat ("The relative virtual path '", virtualDir, "', is not allowed here."));
 
                        string phys_path = HostingEnvironment.MapPath (virtualDir);
                        return Directory.Exists (phys_path);
@@ -71,10 +69,8 @@ namespace System.Web.Hosting {
                        if (virtualPath == null || virtualPath == "")
                                throw new ArgumentNullException ("virtualPath");
 
-                       if (UrlUtils.IsRelativeUrl (virtualPath)) {
-                               string msg = String.Format ("The relative virtual path '{0}', is not allowed here.", virtualPath);
-                               throw new ArgumentException (msg);
-                       }
+                       if (UrlUtils.IsRelativeUrl (virtualPath))
+                               throw new ArgumentException (String.Concat ("The relative virtual path '", virtualPath, "', is not allowed here."));
 
                        string phys_path = HostingEnvironment.MapPath (virtualPath);
                        return File.Exists (phys_path);
@@ -97,10 +93,8 @@ namespace System.Web.Hosting {
                        if (virtualDir == null || virtualDir == "")
                                throw new ArgumentNullException ("virtualDir");
 
-                       if (UrlUtils.IsRelativeUrl (virtualDir)) {
-                               string msg = String.Format ("The relative virtual path '{0}', is not allowed here.", virtualDir);
-                               throw new ArgumentException (msg);
-                       }
+                       if (UrlUtils.IsRelativeUrl (virtualDir)) 
+                               throw new ArgumentException (String.Concat ("The relative virtual path '", virtualDir, "', is not allowed here."));
 
                        return new DefaultVirtualDirectory (virtualDir);
                }
@@ -110,10 +104,8 @@ namespace System.Web.Hosting {
                        if (virtualPath == null || virtualPath == "")
                                throw new ArgumentNullException ("virtualPath");
 
-                       if (UrlUtils.IsRelativeUrl (virtualPath)) {
-                               string msg = String.Format ("The relative virtual path '{0}', is not allowed here.", virtualPath);
-                               throw new ArgumentException (msg);
-                       }
+                       if (UrlUtils.IsRelativeUrl (virtualPath))
+                               throw new ArgumentException (String.Concat ("The relative virtual path '", virtualPath, "', is not allowed here."));
 
                        return new DefaultVirtualFile (virtualPath);
                }
index 20880ef3aaa10eaa1098a7a81b1f9c6948e16939..bfde78cb511a3b27a249680093320fbdc267e8d0 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * SqlProfileProvider.cs, ProfileParser.cs: speed optimization -
+       use String.Concat instead of String.Format in some cases.
+
 2007-12-12  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * ProfileParser.jvm.cs: Profile types loading optimized
index 00bec67f50b985e036af1f36cdd38789863537d2..2eb199ccaf45bff2501894698eae46d3691c36e8 100644 (file)
@@ -46,7 +46,7 @@ namespace System.Web.Profile
                {
                        string typeName;
                        if (AppCodeCompiler.DefaultAppCodeAssemblyName != null)
-                               typeName = String.Format ("ProfileCommon, {0}", AppCodeCompiler.DefaultAppCodeAssemblyName);
+                               typeName = String.Concat ("ProfileCommon, ", AppCodeCompiler.DefaultAppCodeAssemblyName);
                        else
                                typeName = "ProfileCommon";
                        
@@ -61,11 +61,9 @@ namespace System.Web.Profile
                {
                        string typeName;
                        if (AppCodeCompiler.DefaultAppCodeAssemblyName != null)
-                               typeName = String.Format ("ProfileCommon{0}, {1}",
-                                                         groupName,
-                                                         AppCodeCompiler.DefaultAppCodeAssemblyName);
+                               typeName = String.Concat ("ProfileCommon", groupName, ", ", AppCodeCompiler.DefaultAppCodeAssemblyName);
                        else
-                               typeName = String.Format ("ProfileCommon{0}", groupName);
+                               typeName = String.Concat ("ProfileCommon", groupName);
                        
                        Type profileGroupType = Type.GetType (typeName);
                        if (profileGroupType == null) {
index b9b28ea70c10906ed1a21c96c0cfd8cffea4c512..5bfd0fff36919ac051ff662b82ebc190806eebc2 100644 (file)
@@ -416,7 +416,7 @@ namespace System.Web.Profile
                        if (p == null)
                                throw new ArgumentNullException (pName);
                        if (p.Length == 0 || p.Length > length || p.IndexOf (",") != -1)
-                               throw new ArgumentException (String.Format ("invalid format for {0}", pName));
+                               throw new ArgumentException (String.Concat ("invalid format for ", pName));
                }
                
                static int GetReturnValue (DbParameter returnValue)
index fe22f25a837c4dc61fb1d087685cea06ef0ac633..80edef7c089b7966cfb271983a4cbb521c78314c 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * SessionId.cs: speed optimization - use String.Concat instead of
+       String.Format in some cases.
+
 2007-11-23  Marek Habersack  <mhabersack@novell.com>
 
        * SessionSQLServerHandler.cs: Remove a memory leak and improve
index 17d964a12971934b396f488ffcf847ccef0bf43c..1391fc4bc9359e1416845686e6d3b6c3ca559fb8 100644 (file)
@@ -56,7 +56,7 @@ namespace System.Web.SessionState {
                        if (key == null)
                                throw new ArgumentNullException ("key");
                        if (key.Length != half_len)
-                               throw new ArgumentException (String.Format ("key must be {0} bytes long.", half_len));
+                               throw new ArgumentException (String.Concat ("key must be ", half_len.ToString (), " bytes long."));
 
                        // Just a standard hex conversion
                        char[] res = new char [IdLength];
index e188f7b59744ae4b8fcd8dc2712f8f8daba643f9..95eee9ddeb106584502ed497830b4853c122d995 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * HtmlForm.cs, HtmlButton.cs: speed optimization - use String.Concat
+       instead of String.Format in some cases.
+
 2007-11-07  Juraj Skripsky  <js@hotfeet.ch>
 
        * HtmlForm.cs (RenderAttributes): Render ClientID of DefaultButton.
index 82e5bae8639f8c17007f9807b074be074bcd0a6f..8f12ce67519a88922c89eb033fa24acad0cb4741 100644 (file)
@@ -134,8 +134,8 @@ namespace System.Web.UI.HtmlControls {
                        if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
                                if (postback)
                                        writer.WriteAttribute ("onclick",
-                                                              String.Format ("javascript:{{if (typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) {0}}}",
-                                                                             csm.GetPostBackEventReference (this, String.Empty)));
+                                                              String.Concat ("javascript:{if (typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) ",
+                                                                             csm.GetPostBackEventReference (this, String.Empty), "}"));
                                else
                                        writer.WriteAttribute ("onclick",
                                                               "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();");
index 6f490e5e750ce4c38fea842911c0dc0fe564a4de..8817701e6db153541c87733b09b6f953d16c618b 100644 (file)
@@ -319,10 +319,11 @@ namespace System.Web.UI.HtmlControls
                                                                                           ID));
 
                                if (DetermineRenderUplevel ()) {
+                                       string formReference = Page.IsMultiForm ? Page.theForm + "." : String.Empty;
+                                       
                                        w.WriteAttribute (
                                                "onkeypress",
-                                               String.Format ("javascript:return {1}WebForm_FireDefaultButton(event, '{0}')",
-                                                              c.ClientID, Page.IsMultiForm ? Page.theForm + "." : null));
+                                               "javascript:return " + formReference + "WebForm_FireDefaultButton(event, '" + c.ClientID + "')");
                                }
                        }
 #endif
index c9eaaa1b7a1d7e8883584c82dcfd12a8cbf9cd7b..eebd3826d5f099e15ec5ab5888a75d8c3d20ae7e 100644 (file)
@@ -98,8 +98,7 @@ namespace System.Web.UI.WebControls {
                public override string ConnectionString {
                        get {
                                if (connectionString == null) {
-                                       connectionString = String.Format ("Provider={0}; Data Source={1}",
-                                                                         PROVIDER_STRING, GetPhysicalDataFilePath ());
+                                       connectionString = String.Concat ("Provider=", PROVIDER_STRING, "; Data Source=", GetPhysicalDataFilePath ());
                                }
 
                                return connectionString;
index b5e848353caf8d216b410bd62160b56b7612f60b..0185d356cf2986cfc194d62b36cedd340fc4d0b3 100644 (file)
@@ -476,7 +476,7 @@ namespace System.Web.UI.WebControls {
                protected virtual void RegisterValidatorDeclaration ()
                {
                        Page.ClientScript.RegisterArrayDeclaration ("Page_Validators",
-                                                                   String.Format ("document.getElementById ('{0}')", ClientID));
+                                                                   String.Concat ("document.getElementById ('", ClientID, "')"));
                }
 
 #if NET_2_0
index 6effbed64f1630f63b2f38e4b980ae272be9d00b..6e57dffc6427920178e26c53994e8835e7c7e8bc 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * Menu.cs, TreeView.cs: optimize use of String.Format in
+       OnPreRender.
+       Speed optimization - use String.Concat instead of String.Format in
+       some cases.
+
+       * GridView.cs, DetailsView.cs: optimize use of String.Format in
+       OnPreRender.
+
+       * CheckBox.cs, AccessDataSource.cs, WebColorConverter.cs,
+       WebControl.cs,TextBox.cs, DropDownList.cs, ValidationSummary.cs,
+       ListBox.cs, Panel.cs, BaseValidator.cs, LinkButton.cs: speed
+       optimization - use String.Concat instead of String.Format in some cases.
+
 2007-12-13  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * Menu.cs: fixed rendering without head tag on page
index f3365c07d8894ad38318b51ebdfc7d39be4594b0..69f6e89ca9a3da265b1bfd4393823318d58859a7 100644 (file)
@@ -435,7 +435,7 @@ namespace System.Web.UI.WebControls {
                        if (AutoPostBack) {
 #if NET_2_0
                                string onclick = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
-                               onclick = String.Format ("setTimeout('{0}', 0)", onclick.Replace ("\\", "\\\\").Replace ("'", "\\'"));
+                               onclick = String.Concat ("setTimeout('", onclick.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
                                w.AddAttribute (HtmlTextWriterAttribute.Onclick, BuildScriptAttribute ("onclick", onclick));
 #else
                                        w.AddAttribute (HtmlTextWriterAttribute.Onclick,
index 320df9df631114e517a1b11182ad2058a4ba3181..375ee300bec685b270f4de9b58debc523ad1d52c 100644 (file)
@@ -1900,11 +1900,17 @@ namespace System.Web.UI.WebControls
                                        PageIndex = page;\r
                        }\r
                }\r
-               \r
+\r
+               const string onPreRenderScript = @"var {0} = new Object ();\r
+{0}.pageIndex = {1};\r
+{0}.uid = {2};\r
+{0}.form = {3};\r
+";\r
+\r
                protected internal override void OnPreRender (EventArgs e)\r
                {\r
                        base.OnPreRender (e);\r
-                       \r
+\r
                        if (EnablePagingCallbacks)\r
                        {\r
                                if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(DetailsView), "DetailsView.js")) {\r
@@ -1914,10 +1920,12 @@ namespace System.Web.UI.WebControls
                                Page.ClientScript.RegisterHiddenField (ClientID + "_Page", PageIndex.ToString ());\r
                                \r
                                string cgrid = ClientID + "_data";\r
-                               string script = string.Format ("var {0} = new Object ();\n", cgrid);\r
-                               script += string.Format ("{0}.pageIndex = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (PageIndex));\r
-                               script += string.Format ("{0}.uid = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (UniqueID));\r
-                               script += string.Format ("{0}.form = {1};\n", cgrid, Page.theForm);\r
+                               string script = String.Format (onPreRenderScript,\r
+                                                              cgrid,\r
+                                                              ClientScriptManager.GetScriptLiteral (PageIndex),\r
+                                                              ClientScriptManager.GetScriptLiteral (UniqueID),\r
+                                                              Page.theForm);\r
+                               \r
                                Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);\r
                                \r
                                // Make sure the basic script infrastructure is rendered\r
index c351654bd63bb193a5efc23da9a4dffc9a2201cb..b442e5b9d198c64130639b6d9cf2ceec4bd938fd 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Web.UI.WebControls {
                        if (AutoPostBack) {
 #if NET_2_0
                                string onchange = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
-                               onchange = String.Format ("setTimeout('{0}', 0)", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"));
+                               onchange = String.Concat ("setTimeout('", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
                                writer.AddAttribute (HtmlTextWriterAttribute.Onchange, BuildScriptAttribute ("onchange", onchange));
 #else
                                writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
index cc9db9e6b1a0a2e50a5f4a7399bc561fdf578cee..f504d0cb27e7cf93e4eb0c8fefc46c1b404c7bb3 100644 (file)
@@ -2121,25 +2121,34 @@ namespace System.Web.UI.WebControls
                                SortExpression = Page.Request.Form [ClientID + "_SortExpression"];
                        }
                }
-               
+
+
+               const string onPreRenderScript = @"var {0} = new Object ();
+{0}.pageIndex = {1};
+{0}.sortExp = {2};
+{0}.sortDir = {3};
+{0}.uid = {4};
+{0}.form = {5};
+";
                protected internal override void OnPreRender (EventArgs e)
                {
                        base.OnPreRender (e);
-                       
-                       if (EnableSortingAndPagingCallbacks)
-                       {
+
+                       if (EnableSortingAndPagingCallbacks) {
                                if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(GridView), "GridView.js")) {
                                        string url = Page.ClientScript.GetWebResourceUrl (typeof(GridView), "GridView.js");
                                        Page.ClientScript.RegisterClientScriptInclude (typeof(GridView), "GridView.js", url);
                                }
                                
                                string cgrid = ClientID + "_data";
-                               string script = string.Format ("var {0} = new Object ();\n", cgrid);
-                               script += string.Format ("{0}.pageIndex = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (PageIndex));
-                               script += string.Format ("{0}.sortExp = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (SortExpression == null ? "" : SortExpression));
-                               script += string.Format ("{0}.sortDir = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral ((int) SortDirection));
-                               script += string.Format ("{0}.uid = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (UniqueID));
-                               script += string.Format ("{0}.form = {1};\n", cgrid, Page.theForm);
+                               string script = String.Format (onPreRenderScript,
+                                                       cgrid,
+                                                       ClientScriptManager.GetScriptLiteral (PageIndex),
+                                                       ClientScriptManager.GetScriptLiteral (SortExpression == null ? "" : SortExpression),
+                                                       ClientScriptManager.GetScriptLiteral ((int) SortDirection),
+                                                       ClientScriptManager.GetScriptLiteral (UniqueID),
+                                                       Page.theForm);
+                               
                                Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
                                
                                // Make sure the basic script infrastructure is rendered
@@ -2147,7 +2156,7 @@ namespace System.Web.UI.WebControls
                                Page.ClientScript.GetPostBackClientHyperlink (this, "");
                        }
                }
-
+               
                protected internal override void Render (HtmlTextWriter writer)
                {
                        PrepareControlHierarchy ();
index 2042d5ba39feaff784ce27ba1d1390095743feb1..fc7d23e84d5f8e4c79d740ebfba0cad438be0803 100644 (file)
@@ -89,8 +89,8 @@ namespace System.Web.UI.WebControls {
                        if (CausesValidation && Page.AreValidatorsUplevel ()) {
                                ClientScriptManager csm = new ClientScriptManager (Page);
                                w.AddAttribute (HtmlTextWriterAttribute.Href,
-                                               String.Format ("javascript:{{if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); {0};}}",
-                                                              csm.GetPostBackEventReference (this, String.Empty)));
+                                               String.Concat ("javascript:{if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ",
+                                                              csm.GetPostBackEventReference (this, String.Empty), ";}"));
                        } else {
                                w.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink (this, ""));
                        }
index cd1cbeed67238d5cc56df5802360fbc7052bab0b..3ae7bd86f32a0ac8435b1be7bf9e9e52029a03d3 100644 (file)
@@ -147,7 +147,7 @@ namespace System.Web.UI.WebControls {
                        if (AutoPostBack) {
 #if NET_2_0
                                string onchange = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
-                               onchange = String.Format ("setTimeout('{0}', 0)", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"));
+                               onchange = String.Concat ("setTimeout('", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
                                writer.AddAttribute (HtmlTextWriterAttribute.Onchange, BuildScriptAttribute ("onchange", onchange));
 #else
                                writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
index f49251d66064f3a2504161a348e8a6828ea8f092..ef3e6233483516448f45d15075ff880724b77245 100644 (file)
@@ -1151,6 +1151,8 @@ namespace System.Web.UI.WebControls
                        EnsureChildControls ();
                        base.OnDataBinding (e);
                }
+
+               const string onPreRenderScript = "var {0} = new Object ();\n{0}.webForm = {1};\n{0}.disappearAfter = {2};\n{0}.vertical = {3};";
                
                protected internal override void OnPreRender (EventArgs e)
                {
@@ -1162,14 +1164,16 @@ namespace System.Web.UI.WebControls
                        }
                        
                        string cmenu = ClientID + "_data";
-                       string script = string.Concat ("var ", cmenu, " = new Object ();\n");
-                       script += string.Format ("{0}.webForm = {1};\n", cmenu, Page.IsMultiForm ? Page.theForm : "window");
-                       script += string.Format ("{0}.disappearAfter = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DisappearAfter));
-                       script += string.Format ("{0}.vertical = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (Orientation == Orientation.Vertical));
+                       string script = String.Format (onPreRenderScript,
+                                                      cmenu,
+                                                      Page.IsMultiForm ? Page.theForm : "window",
+                                                      ClientScriptManager.GetScriptLiteral (DisappearAfter),
+                                                      ClientScriptManager.GetScriptLiteral (Orientation == Orientation.Vertical));                     
+
                        if (DynamicHorizontalOffset != 0)
-                               script += string.Format ("{0}.dho = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DynamicHorizontalOffset));
+                               script += String.Concat (cmenu, ".dho = ", ClientScriptManager.GetScriptLiteral (DynamicHorizontalOffset), ";\n");
                        if (DynamicVerticalOffset != 0)
-                               script += string.Format ("{0}.dvo = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DynamicVerticalOffset));
+                               script += String.Concat (cmenu, ".dvo = ", ClientScriptManager.GetScriptLiteral (DynamicVerticalOffset), ";\n");
                        
                        // The order in which styles are defined matters when more than one class
                        // is assigned to an element
@@ -1597,6 +1601,11 @@ namespace System.Web.UI.WebControls
                        return (item.Depth + 1 < StaticDisplayLevels + MaximumDynamicDisplayLevels) && item.ChildItems.Count > 0;
                }
 
+               static string MakeHandlerJavaScript (string handlerName, string param1, string param2, string param3)
+               {
+                       return "javascript:Menu_" + handlerName + "('" + param1 + "','" + param2 + "'," + param3 + ")";
+               }
+               
                void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool notLast, bool isFirst) {
                        bool displayChildren = DisplayChildren (item);
                        bool dynamicChildren = displayChildren && (item.Depth + 1 >= StaticDisplayLevels);
@@ -1615,16 +1624,20 @@ namespace System.Web.UI.WebControls
 
                        string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
                        if (dynamicChildren) {
-                               writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
-                               writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}')", ClientID, item.Path));
-                       }
-                       else if (isDynamicItem) {
-                               writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverDynamicLeafItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
-                               writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
-                       }
-                       else {
-                               writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverStaticLeafItem ('{0}','{1}')", ClientID, item.Path));
-                               writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}')", ClientID, item.Path));
+                               writer.AddAttribute ("onmouseover",
+                                                    "javascript:Menu_OverItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
+                               writer.AddAttribute ("onmouseout",
+                                                    "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
+                       } else if (isDynamicItem) {
+                               writer.AddAttribute ("onmouseover",
+                                                    "javascript:Menu_OverDynamicLeafItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
+                               writer.AddAttribute ("onmouseout",
+                                                    "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
+                       } else {
+                               writer.AddAttribute ("onmouseover",
+                                                    "javascript:Menu_OverStaticLeafItem ('" + ClientID + "','" + item.Path + "')");
+                               writer.AddAttribute ("onmouseout",
+                                                    "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
                        }
 
                        writer.RenderBeginTag (HtmlTextWriterTag.Td);
@@ -1872,10 +1885,10 @@ namespace System.Web.UI.WebControls
                                }
 
                                if (isDynamicItem && DynamicItemFormatString.Length > 0) {
-                                       writer.Write (string.Format (DynamicItemFormatString, item.Text));
+                                       writer.Write (String.Format (DynamicItemFormatString, item.Text));
                                }
                                else if (!isDynamicItem && StaticItemFormatString.Length > 0) {
-                                       writer.Write (string.Format (StaticItemFormatString, item.Text));
+                                       writer.Write (String.Format (StaticItemFormatString, item.Text));
                                }
                                else {
                                        writer.Write (item.Text);
index 2a0210a1b07d81430f1cfab1258b56ab722c6381..7da440c4a0b67600e700fb301c7dcfbae56b17b8 100644 (file)
@@ -56,7 +56,7 @@ namespace System.Web.UI.WebControls {
                        if (image != "") {
                                image = ResolveClientUrl (image);
 #if !NET_2_0 // see HtmlTextWriter.WriteStyleAttribute(string, string, bool) 
-                               image = String.Format ("url({0})", image);
+                               image = String.Concat ("url(", image, ")");
 #endif
                                w.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, image);
                        }
@@ -68,7 +68,10 @@ namespace System.Web.UI.WebControls {
                                        throw new InvalidOperationException (String.Format ("The DefaultButton of '{0}' must be the ID of a control of type IButtonControl.", ID));
 
                                Page.ClientScript.RegisterWebFormClientScript ();
-                               w.AddAttribute ("onkeypress", String.Format ("javascript:return {1}WebForm_FireDefaultButton(event, '{0}')", button.ClientID, Page.IsMultiForm ? Page.theForm + "." : null));
+
+                               string formReference = Page.IsMultiForm ? Page.theForm + "." : String.Empty;
+                               w.AddAttribute ("onkeypress",
+                                               "javascript:return " + formReference + "WebForm_FireDefaultButton(event, '" + button.ClientID + "')");
                        }
 
                        if (Direction != ContentDirection.NotSet) {
index 66d3d8e25b83c378267a14126458991152d4ec94..35325f16bba527cce3d87152153109f8d15c4e3b 100644 (file)
@@ -150,7 +150,7 @@ namespace System.Web.UI.WebControls {
                                w.AddAttribute ("onkeypress", "if (WebForm_TextBoxKeyHandler(event) == false) return false;", false);
                                
                                string onchange = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
-                               onchange = String.Format ("setTimeout('{0}', 0)", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"));
+                               onchange = String.Concat ("setTimeout('", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
                                w.AddAttribute (HtmlTextWriterAttribute.Onchange, BuildScriptAttribute ("onchange", onchange));
                        }
 #else          
index 0240ddd204e4d7d065f7387285ebeeb9a9d13b2d..1a2951e5309c5ed4314af1532be342dc5fe5a75e 100644 (file)
@@ -1035,6 +1035,9 @@ namespace System.Web.UI.WebControls
                        }
                        return res;
                }
+
+               const string onPreRenderScript_1 = @"var {0} = new Object ();\n{0}.treeId = {1};\n{0}.uid = {2};\n{0}.showImage = {3};\n";
+               const string onPreRenderScript_2 = @"{0}.form = {1};\n{0}.PopulateNode = function(nodeId) {{ {2}; }};\n{0}.populateFromClient = {3};\n{0}.expandAlt = {4};\n{0}.collapseAlt = {5};\n";
                
                protected internal override void OnPreRender (EventArgs e)
                {
@@ -1051,29 +1054,43 @@ namespace System.Web.UI.WebControls
                        }
                        
                        string ctree = ClientID + "_data";
-                       string script = string.Format ("var {0} = new Object ();\n", ctree);
-                       script += string.Format ("{0}.treeId = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ClientID));
-                       script += string.Format ("{0}.uid = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (UniqueID));
-                       script += string.Format ("{0}.showImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));
+                       string script = String.Format (onPreRenderScript_1,
+                                                      ctree,
+                                                      ClientScriptManager.GetScriptLiteral (ClientID),
+                                                      ClientScriptManager.GetScriptLiteral (UniqueID),
+                                                      ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));                      
                        
                        if (ShowExpandCollapse) {
                                bool defaultImages = ShowLines || ImageSet != TreeViewImageSet.Custom || (ExpandImageUrl == "" && CollapseImageUrl == "");
-                               script += string.Format ("{0}.defaultImages = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (defaultImages));
+                               script += String.Concat (ctree, ".defaultImages = ", ClientScriptManager.GetScriptLiteral (defaultImages), ";\n");
                                ImageStyle imageStyle = GetImageStyle ();
                                if (!defaultImages) {
-                                       script += string.Format ("{0}.expandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("plus", imageStyle)));
-                                       script += string.Format ("{0}.collapseImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("minus", imageStyle)));
+                                       script += String.Concat (ctree,
+                                                                ".expandImage = ",
+                                                                ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("plus", imageStyle)),
+                                                                ";\n");
+                                       script += String.Concat (ctree,
+                                                                ".collapseImage = ",
+                                                                ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("minus", imageStyle)),
+                                                                ";\n");
                                }
                                if (PopulateNodesFromClient)
-                                       script += string.Format ("{0}.noExpandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)));
+                                       script += String.Concat (ctree,
+                                                                ".noExpandImage = ",
+                                                                ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)),
+                                                                ";\n");
                        }
 
                        if (Page != null) {
-                               script += string.Format ("{0}.form = {1};\n", ctree, Page.theForm);
-                               script += string.Format ("{0}.PopulateNode = function(nodeId) {{ {1}; }};\n", ctree, Page.ClientScript.GetCallbackEventReference ("this.uid", "nodeId", "TreeView_PopulateCallback", "this.treeId + \" \" + nodeId", "TreeView_PopulateCallback", false));
-                               script += string.Format ("{0}.populateFromClient = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (PopulateNodesFromClient));
-                               script += string.Format ("{0}.expandAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (true, null)));
-                               script += string.Format ("{0}.collapseAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (false, null)));
+                               script += String.Format (onPreRenderScript_2,
+                                                        ctree,
+                                                        Page.theForm,
+                                                        Page.ClientScript.GetCallbackEventReference ("this.uid", "nodeId", "TreeView_PopulateCallback",
+                                                                                                     "this.treeId + \" \" + nodeId",
+                                                                                                     "TreeView_PopulateCallback", false),
+                                                        ClientScriptManager.GetScriptLiteral (PopulateNodesFromClient),
+                                                        ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (true, null)),
+                                                        ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (false, null)));
 
                                if (!Page.IsPostBack) {
                                        SetNodesExpandedToDepthRecursive (Nodes);
@@ -1096,8 +1113,12 @@ namespace System.Web.UI.WebControls
                                        if (Page.Header == null)
                                                throw new InvalidOperationException ("Using TreeView.HoverNodeStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                                        RegisterStyle (HoverNodeStyle, HoverNodeLinkStyle);
-                                       script += string.Format ("{0}.hoverClass = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (HoverNodeStyle.RegisteredCssClass));
-                                       script += string.Format ("{0}.hoverLinkClass = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (HoverNodeLinkStyle.RegisteredCssClass));
+                                       script += String.Concat (ctree, ".hoverClass = ",
+                                                                ClientScriptManager.GetScriptLiteral (HoverNodeStyle.RegisteredCssClass),
+                                                                ";\n");
+                                       script += String.Concat (ctree, ".hoverLinkClass = ",
+                                                                ClientScriptManager.GetScriptLiteral (HoverNodeLinkStyle.RegisteredCssClass),
+                                                                ";\n");
                                }
                                
                                Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
index 710d2a143f31dc261e7aa1cbd3d6207331ac2723..810ff0a7e7aadd5f58b365eabab27ed9eb185616 100644 (file)
@@ -258,7 +258,7 @@ namespace System.Web.UI.WebControls {
                        if (EnableClientScript && pre_render_called && Page.AreValidatorsUplevel ()) {
 #endif
                                Page.ClientScript.RegisterArrayDeclaration ("Page_ValidationSummaries",
-                                                                           String.Format ("document.getElementById ('{0}')", ClientID));
+                                                                           String.Concat ("document.getElementById ('", ClientID, "')"));
                        }
 
                        if ((ShowSummary && has_errors) || (EnableClientScript && pre_render_called))
index fa69be4a7b9491b7e9f096e647458a784eeea738..c075091c0461d6b8a16dc4293faeae72cd07ba51 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Web.UI.WebControls {
                        if (s != "0")
                                return s;
 
-                       return String.Format (culture, "#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B);
+                       return String.Concat ("#", c.R.ToString ("X2"), c.G.ToString ("X2"), c.B.ToString ("X2"));
                }
        }
 }
index 2944404baa04a2a2ecc80d5da20163a16c9314f3..1213fdd3045880cb8b77c6a4062840a8f75ee577 100644 (file)
@@ -488,7 +488,7 @@ namespace System.Web.UI.WebControls {
                        if (attr [attr.Length - 1] == ';')
                                attr = attr.TrimEnd (_script_trim_chars);
                        
-                       attr = String.Format ("{0};{1}", attr, tail);
+                       attr = String.Concat (attr, ";", tail);
                        attrs.Remove (name);
                        
                        return attr;
index 58214d8d33ca3addffe0ebae69d8b5b4c50db8fe..53665597dd1d1b3e7cd76888e98bb28d32512275 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <mhabersack@novell.com>
+
+       * ClientScriptManager.cs, MasterPageParser.cs, Control.cs,
+       Page.cs: speed optimization - use String.Concat instead of
+       String.Format in some cases.
+
 2007-12-13 Igor Zelmanovich <igorz@mainsoft.com>
 
        * Page.cs:
index a05657e48e11a188a06dc6737540ec4cd3b46478..e4b3257013ceb8855fd6a103d4f92db64265b282 100644 (file)
@@ -103,10 +103,10 @@ namespace System.Web.UI
                                throw new ArgumentNullException ("control");
                        
                        page.RequiresPostBackScript ();
-               if(page.IsMultiForm)
-                       return String.Format ("{0}.__doPostBack('{1}','{2}')", page.theForm, control.UniqueID, argument);
-               else
-                       return String.Format ("__doPostBack('{0}','{1}')", control.UniqueID, argument);
+                       if(page.IsMultiForm)
+                               return page.theForm + ".__doPostBack('" + control.UniqueID + "','" + argument + "')";
+                       else
+                               return "__doPostBack('" + control.UniqueID + "','" + argument + "')";
                }
 
 #if NET_2_0
@@ -166,17 +166,15 @@ namespace System.Web.UI
                        }
 #endif
 
-                       return String.Format ("{0}WebForm_DoPostback({1},{2},{3},{4},{5},{6},{7},{8})", 
-                                       prefix,
-                                       ClientScriptManager.GetScriptLiteral (options.TargetControl.UniqueID), 
-                                       ClientScriptManager.GetScriptLiteral (options.Argument),
-                                       ClientScriptManager.GetScriptLiteral (actionUrl),
-                                       ClientScriptManager.GetScriptLiteral (options.AutoPostBack),
-                                       ClientScriptManager.GetScriptLiteral (options.PerformValidation),
-                                       ClientScriptManager.GetScriptLiteral (options.TrackFocus),
-                                       ClientScriptManager.GetScriptLiteral (options.ClientSubmit),
-                                       ClientScriptManager.GetScriptLiteral (options.ValidationGroup)
-                               );
+                       return prefix + "WebForm_DoPostback(" +
+                               ClientScriptManager.GetScriptLiteral (options.TargetControl.UniqueID) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.Argument) + "," +
+                               ClientScriptManager.GetScriptLiteral (actionUrl) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.AutoPostBack) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.PerformValidation) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.TrackFocus) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.ClientSubmit) + "," +
+                               ClientScriptManager.GetScriptLiteral (options.ValidationGroup) + ")";
                }
 
                internal void RegisterWebFormClientScript ()
@@ -225,8 +223,16 @@ namespace System.Web.UI
                public string GetCallbackEventReference (string target, string argument, string clientCallback, string context, string clientErrorCallback, bool useAsync)
                {
                        RegisterWebFormClientScript ();
-                       
-                       return string.Format ("{6}WebForm_DoCallback({0},{1},{2},{3},{4},{5})", target, ((argument == null) ? "null" : argument), clientCallback, ((context == null) ? "null" : context), ((clientErrorCallback == null) ? "null" : clientErrorCallback), (useAsync ? "true" : "false"), (page.IsMultiForm ? page.theForm + "." : null));
+
+                       string formReference = page.IsMultiForm ? page.theForm + "." : String.Empty;
+
+                       return formReference + "WebForm_DoCallback(" +
+                               target + "," +
+                               ((argument == null) ? "null" : argument) + "," +
+                               clientCallback + "," +
+                               ((context == null) ? "null" : context) + "," +
+                               ((clientErrorCallback == null) ? "null" : clientErrorCallback) + "," +
+                               (useAsync ? "true" : "false") + ")";
                }
 #endif
                
index 5951da88f663a210b02e111b7b1e340db792d55f..25aa31a169a6e7621efc0d4301d447cf0504fa54 100644 (file)
@@ -139,7 +139,7 @@ namespace System.Web.UI
                        defaultNameArray = new string [100];
                        for (int i = 0; i < 100; i++)
 #if NET_2_0
-                               defaultNameArray [i] = String.Format ("ctl{0:D2}", i);
+                               defaultNameArray [i] = String.Concat ("ctl", i.ToString ("D2"));
 #else
                                defaultNameArray [i] = "_ctl" + i;
 #endif
@@ -889,7 +889,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("OnBubbleEvent {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("OnBubbleEvent ", _userId, " ", type_name));
                        }
 #endif
                        return false;
@@ -905,7 +905,7 @@ namespace System.Web.UI
                                        string type_name = null;
                                        if (trace != null) {
                                                type_name = GetType ().Name;
-                                               trace.Write ("control", String.Format ("OnDataBinding {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("OnDataBinding ", _userId, " ", type_name));
                                        }
 #endif
                                        eh (this, e);
@@ -928,7 +928,7 @@ namespace System.Web.UI
                                        string type_name = null;
                                        if (trace != null) {
                                                type_name = GetType ().Name;
-                                               trace.Write ("control", String.Format ("OnInit {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("OnInit ", _userId, " ", type_name));
                                        }
 #endif
                                        eh (this, e);
@@ -951,7 +951,7 @@ namespace System.Web.UI
                                        string type_name = null;
                                        if (trace != null) {
                                                type_name = GetType ().Name;
-                                               trace.Write ("control", String.Format ("OnLoad {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("OnLoad ", _userId, " ", type_name));
                                        }
 #endif
                                        eh (this, e);
@@ -974,7 +974,7 @@ namespace System.Web.UI
                                        string type_name = null;
                                        if (trace != null) {
                                                type_name = GetType ().Name;
-                                               trace.Write ("control", String.Format ("OnPreRender {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("OnPreRender ", _userId, " ", type_name));
                                        }
 #endif
                                        eh (this, e);
@@ -997,7 +997,7 @@ namespace System.Web.UI
                                        string type_name = null;
                                        if (trace != null) {
                                                type_name = GetType ().Name;
-                                               trace.Write ("control", String.Format ("OnUnload {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("OnUnload ", _userId, " ", type_name));
                                        }
 #endif
                                        eh (this, e);
@@ -1068,19 +1068,19 @@ namespace System.Web.UI
                                string type_name = null;
                                if (trace != null) {
                                        type_name = GetType ().Name;
-                                       trace.Write ("control", String.Format ("RaiseBubbleEvent {0} {1}", _userId, type_name));
+                                       trace.Write ("control", String.Concat ("RaiseBubbleEvent ", _userId, " ", type_name));
                                }
 #endif
                                if (c.OnBubbleEvent (source, args)) {
 #if MONO_TRACE
                                        if (trace != null)
-                                               trace.Write ("control", String.Format ("End RaiseBubbleEvent (false) {0} {1}", _userId, type_name));
+                                               trace.Write ("control", String.Concat ("End RaiseBubbleEvent (false) ", _userId, " ", type_name));
 #endif
                                        break;
                                }
 #if MONO_TRACE
                                if (trace != null)
-                                       trace.Write ("control", String.Format ("End RaiseBubbleEvent (true) {0} {1}", _userId, type_name));
+                                       trace.Write ("control", String.Concat ("End RaiseBubbleEvent (true) ", _userId, " ", type_name));
 #endif
                                c = c.Parent;
                        }
@@ -1362,7 +1362,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("LoadRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("LoadRecursive ", _userId, " ", type_name));
                        }
 #endif
 #if NET_2_0
@@ -1381,7 +1381,7 @@ namespace System.Web.UI
 
 #if MONO_TRACE
                        if (trace != null)
-                               trace.Write ("control", String.Format ("End LoadRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("End LoadRecursive ", _userId, " ", type_name));
 #endif
                        stateMask |= LOADED;
                }
@@ -1393,7 +1393,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("UnloadRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("UnloadRecursive ", _userId, " ", type_name));
                        }
 #endif
                        if (HasControls ()) {
@@ -1406,7 +1406,7 @@ namespace System.Web.UI
 
 #if MONO_TRACE
                        if (trace != null)
-                               trace.Write ("control", String.Format ("End UnloadRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("End UnloadRecursive ", _userId, " ", type_name));
 #endif
 #if NET_2_0
                        if (Adapter != null)
@@ -1438,7 +1438,7 @@ namespace System.Web.UI
                                string type_name = null;
                                if (trace != null) {
                                        type_name = GetType ().Name;
-                                       trace.Write ("control", String.Format ("PreRenderRecursive {0} {1}", _userId, type_name));
+                                       trace.Write ("control", String.Concat ("PreRenderRecursive ", _userId, " ", type_name));
                                }
 #endif
 #if NET_2_0
@@ -1457,7 +1457,7 @@ namespace System.Web.UI
                                }
 #if MONO_TRACE
                                if (trace != null)
-                                       trace.Write ("control", String.Format ("End PreRenderRecursive {0} {1}", _userId, type_name));
+                                       trace.Write ("control", String.Concat ("End PreRenderRecursive ", _userId, " ", type_name));
 #endif
                        }
 #if NET_2_0
@@ -1475,7 +1475,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("InitRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("InitRecursive ", _userId, " ", type_name));
                        }
 #endif
                        SetNamingContainer (namingContainer);
@@ -1502,7 +1502,7 @@ namespace System.Web.UI
                                OnInit (EventArgs.Empty);
 #if MONO_TRACE
                        if (trace != null)
-                               trace.Write ("control", String.Format ("End InitRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("End InitRecursive ", _userId, " ", type_name));
 #endif
                        TrackViewState ();
                        stateMask |= INITED;
@@ -1519,7 +1519,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("SaveViewStateRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("SaveViewStateRecursive ", _userId, " ", type_name));
                        }
 #endif
 
@@ -1550,7 +1550,7 @@ namespace System.Web.UI
                        if (thisState == null && controlList == null && controlStates == null) {
 #if MONO_TRACE
                                if (trace != null) {
-                                       trace.Write ("control", String.Format ("End SaveViewStateRecursive {0} {1} saved nothing", _userId, type_name));
+                                       trace.Write ("control", "End SaveViewStateRecursive " + _userId + " " + type_name + " saved nothing");
                                        trace.SaveViewState (this, null);
                                }
 #endif
@@ -1559,7 +1559,7 @@ namespace System.Web.UI
 
 #if MONO_TRACE
                        if (trace != null) {
-                               trace.Write ("control", String.Format ("End SaveViewStateRecursive {0} {1} saved a Triplet", _userId, type_name));
+                               trace.Write ("control", "End SaveViewStateRecursive " + _userId + " " + type_name + " saved a Triplet");
                                trace.SaveViewState (this, thisState);
                        }
 #endif
@@ -1576,7 +1576,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("LoadViewStateRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("LoadViewStateRecursive ", _userId, " ", type_name));
                        }
 #endif
                        Triplet savedInfo = (Triplet) savedState;
@@ -1603,7 +1603,7 @@ namespace System.Web.UI
 
 #if MONO_TRACE
                        if (trace != null)
-                               trace.Write ("control", String.Format ("End LoadViewStateRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("End LoadViewStateRecursive ", _userId, " ", type_name));
 #endif
                        stateMask |= VIEWSTATE_LOADED;
                }
@@ -1618,7 +1618,7 @@ namespace System.Web.UI
                        string type_name = null;
                        if (trace != null) {
                                type_name = GetType ().Name;
-                               trace.Write ("control", String.Format ("ApplyThemeRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("ApplyThemeRecursive ", _userId, " ", type_name));
                        }
 #endif
                        if (Page.PageTheme != null && EnableTheming) {
@@ -1629,7 +1629,7 @@ namespace System.Web.UI
 
 #if MONO_TRACE
                        if (trace != null)
-                               trace.Write ("control", String.Format ("End ApplyThemeRecursive {0} {1}", _userId, type_name));
+                               trace.Write ("control", String.Concat ("End ApplyThemeRecursive ", _userId, " ", type_name));
 #endif
                }
 #endif
index 8871f007e44a14adf60948f1ff2d17907898ddc1..cddbc57af27edf1edd39a4e7da5f63bc56d0dfc5 100644 (file)
@@ -49,7 +49,7 @@ namespace System.Web.UI
                internal MasterPageParser (string virtualPath, string inputFile, HttpContext context)
                : base (virtualPath, inputFile, context, "System.Web.UI.MasterPage")
                {
-                       this.cacheEntryName = String.Format ("@@MasterPagePHIDS:{0}:{1}", virtualPath, inputFile);
+                       this.cacheEntryName = String.Concat ("@@MasterPagePHIDS:", virtualPath, ":", inputFile);
                        
                        contentPlaceHolderIds = HttpRuntime.InternalCache.Get (this.cacheEntryName) as List <string>;
                }
index e7909b416a02745f96fa930443945ab66631a794..ac616bc8812d7961b39572ccf41e9ccccbbbcd66 100644 (file)
@@ -1943,12 +1943,9 @@ public partial class Page : TemplateControl, IHttpHandler
                        ClientScript.RegisterWebFormClientScript ();
                        ClientScript.RegisterStartupScript (
                                "HtmlForm-DefaultButton-StartupScript",
-                               String.Format (
-                                       "<script type=\"text/javascript\">\n{0}\nWebForm_AutoFocus('{1}');\n{2}\n</script>\n",
-                                       ClientScriptManager.SCRIPT_BLOCK_START,
-                                       _focusedControlID,
-                                       ClientScriptManager.SCRIPT_BLOCK_END)
-                       );
+                               "<script type=\"text/javascript\">\n" + ClientScriptManager.SCRIPT_BLOCK_START +
+                               "\nWebForm_AutoFocus('" + _focusedControlID + "');\n" + ClientScriptManager.SCRIPT_BLOCK_END +
+                               "\n</script>\n");
                }
                
                if (Form.SubmitDisabledControls && _hasEnabledControlArray) {
@@ -1963,7 +1960,7 @@ public partial class Page : TemplateControl, IHttpHandler
                if (Form == null || !Page.Form.SubmitDisabledControls || !Page.Form.DetermineRenderUplevel ())
                        return;
                _hasEnabledControlArray = true;
-               Page.ClientScript.RegisterArrayDeclaration (EnabledControlArrayID, String.Format ("'{0}'", control.ClientID));
+               Page.ClientScript.RegisterArrayDeclaration (EnabledControlArrayID, String.Concat ("'", control.ClientID, "'"));
        }
        
        protected virtual void OnSaveStateComplete (EventArgs e)
@@ -2032,20 +2029,19 @@ public partial class Page : TemplateControl, IHttpHandler
 
                try {
                        target.RaiseCallbackEvent (callbackArgument);
-               }
-               catch (Exception ex) {
-                       callbackEventError = String.Format ("e{0}", ex.Message);
+               } catch (Exception ex) {
+                       callbackEventError = String.Concat ("e", ex.Message);
                }
                
                try {
                        callBackResult = target.GetCallbackResult ();
-               }
-               catch (Exception ex) {
-                       return String.Format ("e{0}", ex.Message);
+               } catch (Exception ex) {
+                       return String.Concat ("e", ex.Message);
                }
                
                string eventValidation = ClientScript.GetEventValidationStateFormatted ();
-               return String.Format ("{0}{1}|{2}{3}", callbackEventError, eventValidation == null ? 0 : eventValidation.Length, eventValidation, callBackResult);
+               return callbackEventError + (eventValidation == null ? "0" : eventValidation.Length.ToString ()) + "|" +
+                       eventValidation + callBackResult;
        }
 
        [BrowsableAttribute (false)]