Author: igorz
Date: 2007-06-21 09:19:22 -0400 (Thu, 21 Jun 2007)
New Revision: 80471

Modified:
   trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs
Log:
Implemented RegisterExpandoAttribute and RegisterOnSubmitStatement

Modified: trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs
===================================================================
--- trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs        
2007-06-21 13:15:51 UTC (rev 80470)
+++ trunk/mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs        
2007-06-21 13:19:22 UTC (rev 80471)
@@ -557,9 +557,18 @@
 
                public static void RegisterExpandoAttribute (Control control, 
string controlId, string attributeName, string attributeValue, bool encode)
                {
-                       throw new NotImplementedException ();
+                       Page page = control.Page;
+                       ScriptManager sm = GetCurrent (page);
+                       if (sm.IsInAsyncPostBack)
+                               sm.RegisterExpandoAttribute (controlId, 
attributeName, attributeValue, encode);
+                       else
+                               page.ClientScript.RegisterExpandoAttribute 
(controlId, attributeName, attributeValue, encode);
                }
 
+               private void RegisterExpandoAttribute (string controlId, string 
attributeName, string attributeValue, bool encode) {
+                       // seems MS do nothing.
+               }
+
                public static void RegisterHiddenField (Control control, string 
hiddenFieldName, string hiddenFieldInitialValue)
                {
                        RegisterHiddenField (control.Page, hiddenFieldName, 
hiddenFieldInitialValue);
@@ -584,12 +593,16 @@
 
                public static void RegisterOnSubmitStatement (Control control, 
Type type, string key, string script)
                {
-                       throw new NotImplementedException ();
+                       RegisterOnSubmitStatement (control.Page, type, key, 
script);
                }
 
                public static void RegisterOnSubmitStatement (Page page, Type 
type, string key, string script)
                {
-                       throw new NotImplementedException ();
+                       ScriptManager sm = GetCurrent (page);
+                       if (sm.IsInAsyncPostBack)
+                               RegisterScript (ref sm._clientScriptBlocks, 
type, key, script, ScriptEntryType.OnSubmit);
+                       else
+                               page.ClientScript.RegisterOnSubmitStatement 
(type, key, script);
                }
 
                public void RegisterPostBackControl (Control control)
@@ -645,7 +658,7 @@
                        ScriptEntry entry = scriptList;
 
                        while (entry != null) {
-                               if (entry.Type == type && entry.Key == key)
+                               if (entry.Type == type && entry.Key == key && 
entry.ScriptEntryType == scriptEntryType)
                                        return;
                                last = entry;
                                entry = entry.Next;
@@ -782,6 +795,9 @@
                                case ScriptEntryType.ScriptPath:
                                        WriteCallbackOutput (output, 
scriptBlock, scriptPath, scriptList.Script);
                                        break;
+                               case ScriptEntryType.OnSubmit:
+                                       WriteCallbackOutput (output, onSubmit, 
null, scriptList.Script);
+                                       break;
                                }
                                scriptList = scriptList.Next;
                        }
@@ -1009,7 +1025,8 @@
                {
                        ScriptContentNoTags,
                        ScriptContentWithTags,
-                       ScriptPath
+                       ScriptPath,
+                       OnSubmit
                }
 
                sealed class ArrayDeclaration

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

Reply via email to