2007-07-24 Igor Zelmanovich <igorz@mainsoft.com>
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 24 Jul 2007 12:19:00 +0000 (12:19 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 24 Jul 2007 12:19:00 +0000 (12:19 -0000)
* TreeView.cs: refactoring:
* TreeView.js:
used ClientScriptManager.GetCallbackEventReference API instead calling
WebForm_DoCallback explicit.

2007-07-24 Igor Zelmanovich <igorz@mainsoft.com>

* ClientScriptManager.cs: fixed: GetCallbackEventReference method.

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

mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs

index dbba376b5af5e0172b93bcccdec1b4a68aa12b1b..d1be35749521d727323e3f52b6df98ca29538564 100644 (file)
@@ -1,3 +1,10 @@
+2007-07-24 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * TreeView.cs: refactoring:
+       * TreeView.js:
+       used ClientScriptManager.GetCallbackEventReference API instead calling 
+       WebForm_DoCallback explicit.
+               
 2007-07-15 Igor Zelmanovich <igorz@mainsoft.com>
 
        * BaseValidator.cs: for NET_2_0: fixed client side validation.
index e7556e73233a16f39042c6f121a1b64e4a8245a1..15f7c97265a4ee5f7f926a063e552019de66f25c 100644 (file)
@@ -1052,6 +1052,7 @@ 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));
                        
@@ -1069,6 +1070,7 @@ namespace System.Web.UI.WebControls
 
                        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)));
index 8e2c9efe45c5c2cf79d7d3381b3d1ccc227b19b4..dfc5c7db6c4ff967661f330a18ca67f1c89db41b 100644 (file)
@@ -8,7 +8,7 @@ function TreeView_ToggleExpand (treeId, nodeId) {
        var expand = node.style.display == "none";
        
        if (tree.populateFromClient && expand && node.populated != true && (node.innerHTML.length == 0 || node.hasError)) {
-               WebForm_DoCallback (tree.uid, nodeId, TreeView_PopulateCallback, treeId + " " + nodeId, TreeView_PopulateCallback, false, tree.form)
+               tree.PopulateNode (nodeId);
                return;
        }
        
index 7de99f1c7919f2084f599bd739d0e890355edd03..ed37506fc56c4671b540b16e3a215da28a5fa76d 100644 (file)
@@ -1,4 +1,8 @@
-2007-07-28 Igor Zelmanovich <igorz@mainsoft.com>
+2007-07-24 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * ClientScriptManager.cs: fixed: GetCallbackEventReference method.
+               
+2007-07-23 Igor Zelmanovich <igorz@mainsoft.com>
 
        * Page.cs: refactoring: __doPostBack client script
        It is a part of adapting System.Web to work whith 
index be2381a998945365a9c7e06d5c1a9163515762f5..1b76353105495dfcf7f849c50096c86404b9fa95 100644 (file)
@@ -214,14 +214,14 @@ namespace System.Web.UI
                        if(!(control is ICallbackEventHandler))
                                throw new InvalidOperationException ("The control must implement the ICallbackEventHandler interface and provide a RaiseCallbackEvent method.");
 
-                       return GetCallbackEventReference (control.UniqueID, argument, clientCallback, context, clientErrorCallback, useAsync);
+                       return GetCallbackEventReference ("'" + control.UniqueID + "'", argument, clientCallback, context, clientErrorCallback, useAsync);
                }
 
                public string GetCallbackEventReference (string target, string argument, string clientCallback, string context, string clientErrorCallback, bool useAsync)
                {
                        RegisterWebFormClientScript ();
                        
-                       return string.Format ("WebForm_DoCallback('{0}',{1},{2},{3},{4},{5},{6})", target, argument, clientCallback, context, ((clientErrorCallback == null) ? "null" : clientErrorCallback), (useAsync ? "true" : "false"), page.theForm);
+                       return string.Format ("WebForm_DoCallback({0},{1},{2},{3},{4},{5},{6})", target, argument, clientCallback, context, ((clientErrorCallback == null) ? "null" : clientErrorCallback), (useAsync ? "true" : "false"), page.theForm);
                }
 #endif