Author: igorz
Date: 2006-09-17 10:45:58 -0400 (Sun, 17 Sep 2006)
New Revision: 65550

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
Log:
make rendering of the onclick attribute to consider ValidationGroup property

Modified: trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog     
2006-09-17 14:41:30 UTC (rev 65549)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog     
2006-09-17 14:45:58 UTC (rev 65550)
@@ -1,5 +1,10 @@
 2006-09-17  Igor Zelmanovich  <[EMAIL PROTECTED]>
 
+       * HtmlButton.cs: 
+       make rendering of the onclick attribute to consider ValidationGroup 
property    
+
+2006-09-17  Igor Zelmanovich  <[EMAIL PROTECTED]>
+
        * HtmlInputImage.cs: 
        make rendering of the onclick attribute to consider ValidationGroup 
property    
 

Modified: trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs 
2006-09-17 14:41:30 UTC (rev 65549)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs 
2006-09-17 14:45:58 UTC (rev 65550)
@@ -118,6 +118,13 @@
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
                        ClientScriptManager csm = new ClientScriptManager 
(Page);
+#if NET_2_0
+                       if (Page != null && Events [ServerClickEvent] != null) {
+                               PostBackOptions options = GetPostBackOptions ();
+                               Attributes ["onclick"] += 
Page.ClientScript.GetPostBackEventReference (options);
+                               writer.WriteAttribute ("language", 
"javascript");
+                       }
+#else          
                        bool postback = false;
 
                        if (Page != null && Events [ServerClickEvent] != null)
@@ -140,10 +147,27 @@
 
                                writer.WriteAttribute ("language", 
"javascript");
                        }
+#endif
 
                        base.RenderAttributes (writer);
                }
 
+#if NET_2_0
+               PostBackOptions GetPostBackOptions () {
+                       PostBackOptions options = new PostBackOptions (this);
+                       options.ValidationGroup = null;
+                       options.ActionUrl = null;
+                       options.Argument = "";
+                       options.RequiresJavaScriptProtocol = false;
+                       options.ClientSubmit = true;
+                       options.PerformValidation = CausesValidation && Page != 
null && Page.AreValidatorsUplevel (ValidationGroup);
+                       if (options.PerformValidation)
+                               options.ValidationGroup = ValidationGroup;
+
+                       return options;
+               }
+#endif
+
                [WebSysDescription("")]
                [WebCategory("Action")]
                public event EventHandler ServerClick {

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

Reply via email to