Author: igorz
Date: 2006-09-18 11:51:23 -0400 (Mon, 18 Sep 2006)
New Revision: 65586

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
Log:
make rendering of the href attribute to consider ValidationGroup property.
Page.Validate() is called when CausesValidation=true


Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs        
2006-09-18 15:40:31 UTC (rev 65585)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs        
2006-09-18 15:51:23 UTC (rev 65586)
@@ -49,6 +49,8 @@
        [SupportsEventValidation]
        public class BulletedList : ListControl, IPostBackEventHandler {
                
+               PostBackOptions postBackOptions;
+
                [MonoTODO ("we are missing a new style enum, we should be using 
it")]
                protected override void AddAttributesToRender (HtmlTextWriter 
writer)
                {
@@ -142,7 +144,7 @@
 
                                case BulletedListDisplayMode.LinkButton:
                                        if (Enabled && item.Enabled)
-                                               writer.AddAttribute 
(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink 
(this, (index.ToString (CultureInfo.InvariantCulture))));
+                                               writer.AddAttribute 
(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference 
(GetPostBackOptions (index.ToString (CultureInfo.InvariantCulture))));
                                        else
                                                writer.AddAttribute 
(HtmlTextWriterAttribute.Disabled, "disabled");
                                        writer.RenderBeginTag 
(HtmlTextWriterTag.A);
@@ -151,6 +153,21 @@
                                        break;
                        }
                }
+
+               PostBackOptions GetPostBackOptions (string argument) {
+                       if (postBackOptions == null) {
+                               postBackOptions = new PostBackOptions (this);
+                               postBackOptions.ActionUrl = null;
+                               postBackOptions.ValidationGroup = null;
+                               postBackOptions.RequiresJavaScriptProtocol = 
true;
+                               postBackOptions.ClientSubmit = true;
+                               postBackOptions.PerformValidation = 
CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup);
+                               if (postBackOptions.PerformValidation)
+                                       postBackOptions.ValidationGroup = 
ValidationGroup;
+                       }
+                       postBackOptions.Argument = argument;
+                       return postBackOptions;
+               }
                
                protected internal override void RenderContents (HtmlTextWriter 
writer)
                {
@@ -172,11 +189,10 @@
                        RaisePostBackEvent (eventArgument);
                }
                        
-               [MonoTODO ("ListControl has a CausesValidation prop in v1.2, we 
need to use it")]
                protected virtual void RaisePostBackEvent (string eventArgument)
                {
-                       //if (CausesValidation)
-                       //      Page.Validate ();
+                       if (CausesValidation)
+                               Page.Validate (ValidationGroup);
                        
                        this.OnClick (new BulletedListEventArgs (int.Parse 
(eventArgument, CultureInfo.InvariantCulture)));
                }

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-09-18 15:40:31 UTC (rev 65585)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-09-18 15:51:23 UTC (rev 65586)
@@ -1,5 +1,11 @@
 2006-09-18 Igor Zelmanovich <[EMAIL PROTECTED]>
 
+       * BulletedLis.cs: 
+       make rendering of the href attribute to consider ValidationGroup 
property.
+       Page.Validate() is called when CausesValidation=true
+       
+2006-09-18 Igor Zelmanovich <[EMAIL PROTECTED]>
+
        * ListBox.cs: 
        make rendering of the onchange attribute to consider ValidationGroup 
        property.

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

Reply via email to