New test.
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / CheckBoxList.cs
index 2acfcfe02e6a678241402ceaecab2e73e3d37d19..463898453173abb1447891695b1e7a53e8588c16 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Globalization;
 using System.Collections.Specialized;
 using System.ComponentModel;
-
+using System.Security.Permissions;
 
 namespace System.Web.UI.WebControls {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class CheckBoxList : ListControl, IRepeatInfoUser,
                                    INamingContainer, IPostBackDataHandler {
 
@@ -138,40 +140,6 @@ namespace System.Web.UI.WebControls {
                        }
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual bool HasFooter 
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasHeader
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasSeparators
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual int RepeatedItemCount
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-#endif         
-
                private TableStyle TableStyle {
                        get { return (TableStyle) ControlStyle; }
                }
@@ -187,15 +155,6 @@ namespace System.Web.UI.WebControls {
                        return this;
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual Style GetItemStyle (ListItemType itemType,
-                                                     int repeatIndex)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-               
 #if NET_2_0
                protected internal
 #else          
@@ -244,18 +203,6 @@ namespace System.Web.UI.WebControls {
                                TabIndex = ti;
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual void RenderItem (ListItemType itemType,
-                                                  int repeatIndex,
-                                                  RepeatInfo repeatInfo,
-                                                  HtmlTextWriter w)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-
-
 #if NET_2_0
                protected virtual
 #endif
@@ -291,6 +238,10 @@ namespace System.Web.UI.WebControls {
 #endif
                void RaisePostDataChangedEvent ()
                {
+#if NET_2_0
+                       if (CausesValidation)
+                               Page.Validate (ValidationGroup);
+#endif
                        OnSelectedIndexChanged (EventArgs.Empty);
                }
 
@@ -305,31 +256,85 @@ namespace System.Web.UI.WebControls {
                        RaisePostDataChangedEvent ();
                }
 
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasFooter 
+               {
+                       get {
+                               return false;
+                       }
+               }
+
                bool IRepeatInfoUser.HasFooter {
-                       get { return false; }
+                       get { return HasFooter; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasHeader
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasHeader {
-                       get { return false; }
+                       get { return HasHeader; }
+               }
+
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasSeparators
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasSeparators {
-                       get { return false; }
+                       get { return HasSeparators; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               int RepeatedItemCount
+               {
+                       get {
+                               return Items.Count;
+                       }
                }
 
                int IRepeatInfoUser.RepeatedItemCount {
-                       get { return Items.Count; }
+                       get { return RepeatedItemCount; }
                }
 
-               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
-                               int repeatIndex)
+#if NET_2_0
+               protected virtual
+#endif
+               Style GetItemStyle (ListItemType itemType,
+                                   int repeatIndex)
                {
                        return null;
                }
 
-               void IRepeatInfoUser.RenderItem (ListItemType itemType,
-                               int repeatIndex, RepeatInfo repeatInfo,
-                               HtmlTextWriter writer)
+               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
+                                                   int repeatIndex)
+               {
+                       return GetItemStyle (itemType, repeatIndex);
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               void RenderItem (ListItemType itemType,
+                                int repeatIndex,
+                                RepeatInfo repeatInfo,
+                                HtmlTextWriter writer)
                {
                        ListItem item = Items [repeatIndex];
 
@@ -337,7 +342,20 @@ namespace System.Web.UI.WebControls {
                        check_box.Text = item.Text;
                        check_box.AutoPostBack = AutoPostBack;
                        check_box.Checked = item.Selected;
+                       check_box.TextAlign = TextAlign;
+                       check_box.Enabled = Enabled;
+#if NET_2_0
+                       check_box.ValidationGroup = ValidationGroup;
+                       check_box.CausesValidation = CausesValidation;
+#endif
                        check_box.RenderControl (writer);
                }
+
+               void IRepeatInfoUser.RenderItem (ListItemType itemType,
+                                                int repeatIndex, RepeatInfo repeatInfo,
+                                                HtmlTextWriter writer)
+               {
+                       RenderItem (itemType, repeatIndex, repeatInfo, writer);
+               }
        }
 }