浏览代码

2005-05-18 Lluis Sanchez Gual <[email protected]>

	* TreeView.cs: Always render the startup script. This fixes
	bug #74949. 


svn path=/trunk/mcs/; revision=44690
Lluis Sanchez 20 年之前
父节点
当前提交
46dbfec58d

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

@@ -1,3 +1,8 @@
+2005-05-18  Lluis Sanchez Gual <[email protected]>
+
+	* TreeView.cs: Always render the startup script. This fixes
+	bug #74949. 
+
 2005-05-13  Lluis Sanchez Gual <[email protected]>
 
 	* WizardStepBase.cs:

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

@@ -934,27 +934,27 @@ namespace System.Web.UI.WebControls
 			if (EnableClientScript && !Page.ClientScript.IsClientScriptIncludeRegistered (typeof(TreeView), "TreeView.js")) {
 				string url = Page.ClientScript.GetWebResourceUrl (typeof(TreeView), "TreeView.js");
 				Page.ClientScript.RegisterClientScriptInclude (typeof(TreeView), "TreeView.js", url);
+			}
 				
-				string ctree = ClientID + "_data";
-				string script = string.Format ("var {0} = new Object ();\n", ctree);
-				script += string.Format ("{0}.showImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));
-				
-				if (ShowExpandCollapse) {
-					bool defaultImages = ShowLines || ImageSet != TreeViewImageSet.Custom || (ExpandImageUrl == "" && CollapseImageUrl == "");
-					script += string.Format ("{0}.defaultImages = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (defaultImages));
-					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)));
-					}
-					if (PopulateNodesFromClient)
-						script += string.Format ("{0}.noExpandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)));
+			string ctree = ClientID + "_data";
+			string script = string.Format ("var {0} = new Object ();\n", ctree);
+			script += string.Format ("{0}.showImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));
+			
+			if (ShowExpandCollapse) {
+				bool defaultImages = ShowLines || ImageSet != TreeViewImageSet.Custom || (ExpandImageUrl == "" && CollapseImageUrl == "");
+				script += string.Format ("{0}.defaultImages = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (defaultImages));
+				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.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)));
-				Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
+				if (PopulateNodesFromClient)
+					script += string.Format ("{0}.noExpandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)));
 			}
+			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)));
+			Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
 
 			if (EnableClientScript) {
 				Page.ClientScript.RegisterHiddenField (ClientID + "_ExpandStates", GetExpandStates ());