-/**\r
-* Namespace: System.Web.UI.WebControls\r
-* Class: CheckBoxList\r
-*\r
-* Author: Gaurav Vaish\r
-* Maintainer: gvaish@iitk.ac.in\r
-* Contact: <gvaish@iitk.ac.in>\r
-* Implementation: yes\r
-* Status: 100%\r
-*\r
-* (C) Gaurav Vaish (2001)\r
-*/\r
+//
+// 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.
+//
\r
using System;\r
using System.Collections.Specialized;\r
\r
namespace System.Web.UI.WebControls\r
{\r
- [DefaultEvent("SelectedIndexChanged")]\r
- [DefaultProperty("DataSource")]\r
- [ParseChildren(true, "Items")]\r
- [PersistChildren(false)]\r
public class CheckBoxList: ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler\r
{\r
CheckBox checkBoxRepeater;\r
checkBoxRepeater = new CheckBox();\r
checkBoxRepeater.ID = "0";\r
checkBoxRepeater.EnableViewState = false;\r
- checkBoxRepeater.Controls.Add(this);\r
+ Controls.Add (checkBoxRepeater);\r
isChangeNotified = false;\r
}\r
-\r
+
+ [DefaultValue (-1), Bindable (true), WebCategory ("Layout")]
+ [WebSysDescription ("The border left within a CheckBox.")]\r
public virtual int CellPadding\r
{\r
get\r
((TableStyle)ControlStyle).CellPadding = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (-1), Bindable (true), WebCategory ("Layout")]
+ [WebSysDescription ("The border left between CheckBoxes.")]\r
public virtual int CellSpacing\r
{\r
get\r
((TableStyle)ControlStyle).CellSpacing = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (0), Bindable (true), WebCategory ("Layout")]
+ [WebSysDescription ("The number of columns that should be used to display the CheckBoxes.")]\r
public virtual int RepeatColumns\r
{\r
get\r
ViewState["RepeatColumns"] = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (typeof (RepeatDirection), "Vertical"), Bindable (true), WebCategory ("Layout")]
+ [WebSysDescription ("The direction that is followed when doing the layout.")]\r
public virtual RepeatDirection RepeatDirection\r
{\r
get\r
ViewState["RepeatDirection"] = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (typeof (RepeatLayout), "Table"), Bindable (true), WebCategory ("Layout")]
+ [WebSysDescription ("The method used to create the layout.")]\r
public virtual RepeatLayout RepeatLayout\r
{\r
get\r
ViewState["RepeatLayout"] = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (typeof (TextAlign), "Right"), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("The alignment of the CheckBox text.")]\r
public virtual TextAlign TextAlign\r
{\r
get\r
bool dirtyFlag = false;\r
short tTabIndex = TabIndex;\r
Style s = (ControlStyleCreated ? ControlStyle : null);\r
- if(TabIndex > 0)\r
+ if(TabIndex != 0)\r
{\r
if(!ViewState.IsItemDirty("TabIndex"))\r
dirtyFlag = true;\r
ri.RepeatLayout = RepeatLayout;\r
ri.RepeatDirection = RepeatDirection;\r
ri.RenderRepeater(writer, this, s, this);\r
- if(tTabIndex > 0)\r
+ if(tTabIndex != 0)\r
{\r
TabIndex = tTabIndex;\r
}\r
ViewState.SetItemDirty("TabIndex", false);\r
}\r
}\r
-\r
- bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)\r
- {\r
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ if (!Enabled)
+ return false;
+
int index = Int32.Parse(postDataKey.Substring(UniqueID.Length + 1));\r
- if(index >= 0 && index < Items.Count)\r
- {\r
- bool exists = (postCollection[postDataKey]!=null);\r
+ if(index >= 0 && index < Items.Count)
+ {
+ string v = postCollection [postDataKey];
+ bool exists = (v != null);
if(Items[index].Selected != exists)\r
{\r
Items[index].Selected = exists;\r
checkBoxRepeater.Text = Items[repeatIndex].Text;\r
checkBoxRepeater.TextAlign = TextAlign;\r
checkBoxRepeater.Checked = Items[repeatIndex].Selected;\r
+ checkBoxRepeater.Enabled = Enabled;\r
checkBoxRepeater.RenderControl(writer);\r
}\r
}\r