Browse Source

2007-12-13 Marek Habersack <[email protected]>

	* 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  <[email protected]>

	* 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  <[email protected]>

	* HtmlForm.cs, HtmlButton.cs: speed optimization - use String.Concat
	instead of String.Format in some cases.
2007-12-13  Marek Habersack  <[email protected]>

	* AssemblyResourceLoader.cs: speed optimization - use String.Concat
	instead of String.Format in some cases.
2007-12-13  Marek Habersack  <[email protected]>

	* SessionId.cs: 
	speed optimization - use String.Concat
	instead of String.Format in some cases.
2007-12-13  Marek Habersack  <[email protected]>

	* SqlProfileProvider.cs, ProfileParser.cs: speed optimization -
	use String.Concat instead of String.Format in some cases.
2007-12-13  Marek Habersack  <[email protected]>

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

svn path=/trunk/mcs/; revision=91230
Marek Habersack 18 years ago
parent
commit
3476c409c3
35 changed files with 254 additions and 167 deletions
  1. 7 8
      mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
  2. 5 0
      mcs/class/System.Web/System.Web.Handlers/ChangeLog
  3. 2 2
      mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
  4. 4 9
      mcs/class/System.Web/System.Web.Hosting/ApplicationManager.cs
  5. 6 0
      mcs/class/System.Web/System.Web.Hosting/ChangeLog
  6. 8 16
      mcs/class/System.Web/System.Web.Hosting/DefaultVirtualPathProvider.cs
  7. 5 0
      mcs/class/System.Web/System.Web.Profile/ChangeLog
  8. 3 5
      mcs/class/System.Web/System.Web.Profile/ProfileParser.cs
  9. 1 1
      mcs/class/System.Web/System.Web.Profile/SqlProfileProvider.cs
  10. 5 0
      mcs/class/System.Web/System.Web.SessionState/ChangeLog
  11. 1 1
      mcs/class/System.Web/System.Web.SessionState/SessionId.cs
  12. 5 0
      mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
  13. 2 2
      mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
  14. 3 2
      mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
  15. 1 2
      mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs
  16. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
  17. 15 0
      mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
  18. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
  19. 14 6
      mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
  20. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
  21. 20 11
      mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
  22. 2 2
      mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
  23. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
  24. 31 18
      mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
  25. 5 2
      mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
  26. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
  27. 36 15
      mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs
  28. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
  29. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
  30. 1 1
      mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
  31. 6 0
      mcs/class/System.Web/System.Web.UI/ChangeLog
  32. 23 17
      mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
  33. 25 25
      mcs/class/System.Web/System.Web.UI/Control.cs
  34. 1 1
      mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
  35. 10 14
      mcs/class/System.Web/System.Web.UI/Page.cs

+ 7 - 8
mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs

@@ -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);

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

@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* AssemblyResourceLoader.cs: speed optimization - use String.Concat
+	instead of String.Format in some cases.
+
 2007-11-12 Igor Zelmanovich <[email protected]>
 
 	* AssemblyResourceLoader.cs:

+ 2 - 2
mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs

@@ -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);

+ 4 - 9
mcs/class/System.Web/System.Web.Hosting/ApplicationManager.cs

@@ -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;
 		}

+ 6 - 0
mcs/class/System.Web/System.Web.Hosting/ChangeLog

@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* ApplicationManager.cs, ApplicationHost.cs,
+	DefaultVirtualPathProvider.cs: speed optimization - use
+	String.Concat instead of String.Format in some cases.
+
 2007-11-03  Gert Driesen  <[email protected]>
 
 	* ApplicationHost.cs: On 2.0, also make PrivateBinPath an absolute

+ 8 - 16
mcs/class/System.Web/System.Web.Hosting/DefaultVirtualPathProvider.cs

@@ -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);
 		}

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

@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* SqlProfileProvider.cs, ProfileParser.cs: speed optimization -
+	use String.Concat instead of String.Format in some cases.
+
 2007-12-12  Vladimir Krasnov  <[email protected]>
 
 	* ProfileParser.jvm.cs: Profile types loading optimized

+ 3 - 5
mcs/class/System.Web/System.Web.Profile/ProfileParser.cs

@@ -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) {

+ 1 - 1
mcs/class/System.Web/System.Web.Profile/SqlProfileProvider.cs

@@ -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)

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

@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* SessionId.cs: speed optimization - use String.Concat instead of
+	String.Format in some cases.
+
 2007-11-23  Marek Habersack  <[email protected]>
 
 	* SessionSQLServerHandler.cs: Remove a memory leak and improve

+ 1 - 1
mcs/class/System.Web/System.Web.SessionState/SessionId.cs

@@ -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];

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

@@ -1,3 +1,8 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* HtmlForm.cs, HtmlButton.cs: speed optimization - use String.Concat
+	instead of String.Format in some cases.
+
 2007-11-07  Juraj Skripsky  <[email protected]>
 
 	* HtmlForm.cs (RenderAttributes): Render ClientID of DefaultButton.

+ 2 - 2
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs

@@ -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();");

+ 3 - 2
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs

@@ -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

+ 1 - 2
mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs

@@ -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;

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs

@@ -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

+ 15 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,18 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* Menu.cs: fixed rendering without head tag on page

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs

@@ -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,

+ 14 - 6
mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs

@@ -1900,11 +1900,17 @@ namespace System.Web.UI.WebControls
 					PageIndex = page;
 			}
 		}
-		
+
+		const string onPreRenderScript = @"var {0} = new Object ();
+{0}.pageIndex = {1};
+{0}.uid = {2};
+{0}.form = {3};
+";
+
 		protected internal override void OnPreRender (EventArgs e)
 		{
 			base.OnPreRender (e);
-			
+
 			if (EnablePagingCallbacks)
 			{
 				if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(DetailsView), "DetailsView.js")) {
@@ -1914,10 +1920,12 @@ namespace System.Web.UI.WebControls
 				Page.ClientScript.RegisterHiddenField (ClientID + "_Page", PageIndex.ToString ());
 				
 				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}.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 (UniqueID),
+							       Page.theForm);
+				
 				Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
 				
 				// Make sure the basic script infrastructure is rendered

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs

@@ -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,

+ 20 - 11
mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs

@@ -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 ();

+ 2 - 2
mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs

@@ -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, ""));
 			}

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs

@@ -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,

+ 31 - 18
mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs

@@ -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);

+ 5 - 2
mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs

@@ -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) {

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs

@@ -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		

+ 36 - 15
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs

@@ -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);

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs

@@ -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))

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs

@@ -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"));
 		}
 	}
 }

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs

@@ -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;

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

@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* 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 <[email protected]>
 
 	* Page.cs:

+ 23 - 17
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs

@@ -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
 		

+ 25 - 25
mcs/class/System.Web/System.Web.UI/Control.cs

@@ -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

+ 1 - 1
mcs/class/System.Web/System.Web.UI/MasterPageParser.cs

@@ -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>;
 		}

+ 10 - 14
mcs/class/System.Web/System.Web.UI/Page.cs

@@ -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)]