X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Web%2FSystem.Web.UI.WebControls%2FCheckBoxList.cs;h=c3be3f946419295bbf6e7e522a7b663501c422ff;hb=0fbb08680b9b655570b5fe2587d73b7c771a35b7;hp=6b8b0e21b1ae3c1627167eee9af642b7f320b53d;hpb=91e5108757827fdca3b3bce33b027ce6daef8091;p=mono.git diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs index 6b8b0e21b1a..c3be3f94641 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs @@ -1,15 +1,34 @@ -/** -* Namespace: System.Web.UI.WebControls -* Class: CheckBoxList -* -* Author: Gaurav Vaish -* Maintainer: gvaish@iitk.ac.in -* Contact: -* Implementation: yes -* Status: 100% -* -* (C) Gaurav Vaish (2001) -*/ +// +// System.Web.UI.WebControls.CheckBoxList.cs +// +// Authors: +// Gaurav Vaish (gvaish@iitk.ac.in) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) Gaurav Vaish (2002) +// (C) 2003 Andreas Nahr +// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// using System; using System.Collections.Specialized; @@ -20,10 +39,6 @@ using System.Web.UI; namespace System.Web.UI.WebControls { - [DefaultEvent("SelectedIndexChanged")] - [DefaultProperty("DataSource")] - [ParseChildren(true, "Items")] - [PersistChildren(false)] public class CheckBoxList: ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler { CheckBox checkBoxRepeater; @@ -34,10 +49,12 @@ namespace System.Web.UI.WebControls checkBoxRepeater = new CheckBox(); checkBoxRepeater.ID = "0"; checkBoxRepeater.EnableViewState = false; - checkBoxRepeater.Controls.Add(this); + Controls.Add (checkBoxRepeater); isChangeNotified = false; } - + + [DefaultValue (-1), Bindable (true), WebCategory ("Layout")] + [WebSysDescription ("The border left within a CheckBox.")] public virtual int CellPadding { get @@ -49,7 +66,9 @@ namespace System.Web.UI.WebControls ((TableStyle)ControlStyle).CellPadding = value; } } - + + [DefaultValue (-1), Bindable (true), WebCategory ("Layout")] + [WebSysDescription ("The border left between CheckBoxes.")] public virtual int CellSpacing { get @@ -61,7 +80,9 @@ namespace System.Web.UI.WebControls ((TableStyle)ControlStyle).CellSpacing = value; } } - + + [DefaultValue (0), Bindable (true), WebCategory ("Layout")] + [WebSysDescription ("The number of columns that should be used to display the CheckBoxes.")] public virtual int RepeatColumns { get @@ -78,7 +99,9 @@ namespace System.Web.UI.WebControls ViewState["RepeatColumns"] = value; } } - + + [DefaultValue (typeof (RepeatDirection), "Vertical"), Bindable (true), WebCategory ("Layout")] + [WebSysDescription ("The direction that is followed when doing the layout.")] public virtual RepeatDirection RepeatDirection { get @@ -95,7 +118,9 @@ namespace System.Web.UI.WebControls ViewState["RepeatDirection"] = value; } } - + + [DefaultValue (typeof (RepeatLayout), "Table"), Bindable (true), WebCategory ("Layout")] + [WebSysDescription ("The method used to create the layout.")] public virtual RepeatLayout RepeatLayout { get @@ -112,7 +137,9 @@ namespace System.Web.UI.WebControls ViewState["RepeatLayout"] = value; } } - + + [DefaultValue (typeof (TextAlign), "Right"), Bindable (true), WebCategory ("Appearance")] + [WebSysDescription ("The alignment of the CheckBox text.")] public virtual TextAlign TextAlign { get @@ -163,7 +190,7 @@ namespace System.Web.UI.WebControls bool dirtyFlag = false; short tTabIndex = TabIndex; Style s = (ControlStyleCreated ? ControlStyle : null); - if(TabIndex > 0) + if(TabIndex != 0) { if(!ViewState.IsItemDirty("TabIndex")) dirtyFlag = true; @@ -173,7 +200,7 @@ namespace System.Web.UI.WebControls ri.RepeatLayout = RepeatLayout; ri.RepeatDirection = RepeatDirection; ri.RenderRepeater(writer, this, s, this); - if(tTabIndex > 0) + if(tTabIndex != 0) { TabIndex = tTabIndex; } @@ -182,13 +209,17 @@ namespace System.Web.UI.WebControls ViewState.SetItemDirty("TabIndex", false); } } - - bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection) - { + + bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection) + { + if (!Enabled) + return false; + int index = Int32.Parse(postDataKey.Substring(UniqueID.Length + 1)); - if(index >= 0 && index < Items.Count) - { - bool exists = (postCollection[postDataKey]!=null); + if(index >= 0 && index < Items.Count) + { + string v = postCollection [postDataKey]; + bool exists = (v != null); if(Items[index].Selected != exists) { Items[index].Selected = exists; @@ -250,6 +281,7 @@ namespace System.Web.UI.WebControls checkBoxRepeater.Text = Items[repeatIndex].Text; checkBoxRepeater.TextAlign = TextAlign; checkBoxRepeater.Checked = Items[repeatIndex].Selected; + checkBoxRepeater.Enabled = Enabled; checkBoxRepeater.RenderControl(writer); } }