瀏覽代碼

2005-07-27 Dick Porter <[email protected]>

	* HtmlInputCheckBoxTest.cs: Tests for HtmlInputCheckBox

2005-07-26  Dick Porter  <[email protected]>

	* HtmlSelectTest.cs: Tests for HtmlSelect

2005-07-21  Dick Porter  <[email protected]>

	* HtmlImageTest.cs: The order of attribute rendering has changed,
	and now matches MS

2005-07-19  Dick Porter  <[email protected]>

	* HtmlImageTest.cs: Added tests for negative values in int
	properties

2005-07-14  Dick Porter  <[email protected]>

	* HtmlFormTest.cs: New set of tests

2005-07-07  Dick Porter  <[email protected]>

	* HtmlImageTest.cs: Unit tests for HtmlImage

2005-08-04  Dick Porter  <[email protected]>

	* DataGridColumnTest.cs: Tests for DataGridColumn

2005-07-29  Dick Porter  <[email protected]>

	* RadioButtonTest.cs: Added tests for RadioButton

2005-07-14  Dick Porter  <[email protected]>

	* CheckBoxTest.cs: Added enum checks

2005-07-13  Dick Porter  <[email protected]>

	* CheckBoxTest.cs: Added tests for CheckBox - currently all
	passing on mono and ms runtimes.

2005-07-14  Dick Porter  <[email protected]>

	* HttpPostedFile.cs: New basic implementation; needs someone to
	figure out what a HttpRequestStream does

2005-08-18  Dick Porter  <[email protected]>

	* HtmlTable.cs, HtmlInputButton.cs, HtmlInputFile.cs, HtmlHead.cs,
	HtmlInputImage.cs, HtmlForm.cs, HtmlInputText.cs,
	HtmlInputCheckBox.cs, HtmlAnchor.cs, HtmlInputRadioButton.cs,
	HtmlButton.cs, HtmlInputHidden.cs, HtmlTextArea.cs,
	HtmlTableRow.cs, HtmlSelect.cs, HtmlControl.cs, HtmlTitle.cs,
	HtmlContainerControl.cs: 2.0 API fixes and stubs and attribute fixes

2005-08-09  Dick Porter  <[email protected]>

	* HtmlSelect.cs: Clear databindings when adding a new one; cope
	with assorted combinations of empty text and value fields; write
	<option> tags manually to match ms HTML output.  All fix nunit
	tests.

2005-08-05  Dick Porter  <[email protected]>

	* HtmlSelect.cs: Fix databinding when one or other of Name and
	Value aren't supplied (thanks to Peter for the patch); Make
	<option> indenting match ms output.

2005-07-29  Dick Porter  <[email protected]>

	* HtmlForm.cs: Simplify the rendering code by using QueryStringRaw
	instead of building the query string by hand

2005-07-27  Dick Porter  <[email protected]>

	* HtmlInputCheckBox.cs: New implementation

2005-07-26  Dick Porter  <[email protected]>

	* HtmlSelect.cs: New implementation

2005-07-24  Dick Porter  <[email protected]>

	* HtmlForm.cs: Add the trailing query string to the form action;
	fixes bug shown in Test/standalone/htmlform/qs_postback.aspx

2005-07-22  Dick Porter  <[email protected]>

	* HtmlInputFile.cs: Add assembly attributes

2005-07-21  Dick Porter  <[email protected]>

	* HtmlImage.cs: The src attribute needs to be a relative URL;
	close the HTML element when rendering attributes, to match the MS
	impl.

	* HtmlForm.cs: Added assembly attributes; don't render ID twice;
	don't render enctype and target if they are empty strings;
	implement a Render overload to keep corcompare quiet.

2005-07-19  Dick Porter  <[email protected]>

	* HtmlImage.cs: Added attributes; use Int32.Parse instead of
	Convert.ToInt32

2005-07-14  Dick Porter  <[email protected]>

	* HtmlInputFile.cs: New implementation

2005-07-14  Dick Porter  <[email protected]>

	* HtmlForm.cs: New Implementation

2005-07-07  Dick Porter  <[email protected]>

	* HtmlImage.cs: New implementation

2005-08-18  Dick Porter  <[email protected]>

	* ControlCachePolicy.cs, PersistChildrenAttribute.cs,
	UserControl.cs, DesignerDataBoundLiteralControl.cs,
	PageStatePersister.cs, DataBoundLiteralControl.cs, Control.cs,
	BasePartialCachingControl.cs, LiteralControl.cs: 2.0 API fixes and
	stubs and attribute fixes

2005-08-11  Dick Porter  <[email protected]>

	* CssStyleCollection.cs: Tweak the css string format to pass a
	unit test

	* AttributeCollection.cs: Don't NRE if someone sets the "style"
	attribute to null.

2005-08-05  Dick Porter  <[email protected]>

	* HtmlTextWriter.cs: Make <option> tags render inline, to match
	the ms output

2005-07-07  Dick Porter  <[email protected]>

	* StateBag.cs: Added internal SetDirty (void) method to fix the
	build

2005-08-18  Dick Porter  <[email protected]>

	* PageAdapter.cs, ControlAdapter.cs: 2.0 stubs

2005-08-18  Dick Porter  <[email protected]>

	* Consts.cs: Added System.Web and Microsoft.VisualStudio.Web
	constants for 2.0

2005-08-18  Dick Porter  <[email protected]>

	* Button.cs, DetailsView.cs, Xml.cs, Table.cs, Menu.cs,
	DataControlButton.cs, Label.cs, ObjectDataSource.cs, CheckBox.cs,
	RadioButton.cs, ListControl.cs, Image.cs, SiteMapPath.cs,
	BaseDataList.cs, DataList.cs, BulletedList.cs,
	DataBoundControl.cs, Login.cs, GridView.cs,
	CompositeDataBoundControl.cs, Wizard.cs, BaseValidator.cs,
	TextBox.cs, CheckBoxList.cs, RadioButtonList.cs, FormView.cs,
	AdRotator.cs, Repeater.cs, MenuItemTemplateContainer.cs,
	DropDownList.cs, HyperLink.cs, ImageMap.cs, MultiView.cs,
	CompositeControl.cs, HierarchicalDataBoundControl.cs, Calendar.cs,
	ListBox.cs, TableCell.cs, WebControl.cs, Literal.cs,
	BaseDataBoundControl.cs, ValidationSummary.cs, ImageButton.cs,
	LinkButton.cs, TreeView.cs: 2.0 API fixes and stubs, and attribute
	fixes

2005-08-11  Dick Porter  <[email protected]>

	* CheckBox.cs: Let ViewState manage removals; apply styles and
	"style" attributes in a surrounding <span>.  Fixes unit tests.

2005-08-05  Dick Porter  <[email protected]>

	* CheckBox.cs: Shut corcompare up a bit more.  Still need to
	figure out how to not use AddAttributesToRender to get it
	completely silent.

	* ButtonColumn.cs: Implement Initialize() and InitializeCell()

	* DataGridColumn.cs: Added the duplicate viewstate manipulation
	methods

2005-08-04  Dick Porter  <[email protected]>

	* DataGridColumn.cs: New implementation

	* DataGrid.cs: 
	* DataGridColumnCollection.cs: Set the DataGridColumn's owner

2005-07-29  Dick Porter  <[email protected]>

	* RadioButton.cs: Hide nonstandard API; remove GroupName from the
	ViewState when it is null.

	* CheckBox.cs: Hide nonstandard API

2005-07-22  Dick Porter  <[email protected]>

	* BoundColumn.cs: 
	* ButtonColumn.cs: Initial stubs

2005-07-22  Dick Porter  <[email protected]>

	* RadioButton.cs:
	* CheckBox.cs: Add assembly attributes

2005-07-13  Dick Porter  <[email protected]>

	* CheckBox.cs: Reverted Ben's enum-to-int ViewState change, remove
	null Text properties from the ViewState, test for TextAlign being
	out of range.  All to make tests pass on both mono and ms
	runtimes.

2005-07-12  Dick Porter  <[email protected]>

	* RadioButton.cs: New implementation

	* CheckBox.cs: Rearrange the attributes rendering to allow
	RadioButton to derive from this

2005-07-11  Dick Porter  <[email protected]>

	* CheckBox.cs: New implementation

	* RadioButton.cs: Initial stubbed version that just compiles

2005-07-08  Dick Porter  <[email protected]>

	* TextAlign.cs: 
	* BorderStyle.cs: Added

svn path=/trunk/mcs/; revision=48915
Dick Porter 20 年之前
父節點
當前提交
3ff73d8d7d

+ 299 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs

@@ -0,0 +1,299 @@
+//
+// System.Web.UI.HtmlControls.HtmlForm.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.ComponentModel;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls 
+{
+	public class HtmlForm : HtmlContainerControl 
+	{
+		public HtmlForm () : base ("form")
+		{
+		}
+
+#if NET_2_0
+		[DefaultValue ("")]
+		[MonoTODO]
+		public string DefaultButton
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[DefaultValue ("")]
+		[MonoTODO]
+		public string DefaultFocus
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif		
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Enctype 
+		{
+			get {
+				string enc = Attributes["enctype"];
+
+				if (enc == null) {
+					return (String.Empty);
+				}
+
+				return (enc);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("enctype");
+				} else {
+					Attributes["enctype"] = value;
+				}
+			}
+		}
+		
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Method 
+		{
+			get {
+				string method = Attributes["method"];
+
+				if (method == null) {
+					return ("post");
+				}
+				
+				return (method);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("method");
+				} else {
+					Attributes["method"] = value;
+				}
+			}
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+#if NET_2_0
+		public virtual
+#else		
+		public
+#endif		
+		string Name 
+		{
+			get {
+				string name = Attributes["name"];
+
+				if (name == null) {
+					return (UniqueID);
+				}
+				
+				return (name);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("name");
+				} else {
+					Attributes["name"] = value;
+				}
+			}
+		}
+
+#if NET_2_0
+		[DefaultValue (false)]
+		[MonoTODO]
+		public virtual bool SubmitDisabledControls 
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif
+			
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Target 
+		{
+			get {
+				string target = Attributes["target"];
+
+				if (target == null) {
+					return (String.Empty);
+				}
+				
+				return (target);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("target");
+				} else {
+					Attributes["target"] = value;
+				}
+			}
+		}
+
+#if NET_2_0
+		public override
+#else		
+		// New in NET1.1 sp1
+		public new
+#endif		
+		string UniqueID
+		{
+			get {
+				return base.UniqueID;
+			}
+		}
+
+#if NET_2_0		
+		[MonoTODO]
+		protected override ControlCollection CreateControlCollection ()
+		{
+			return base.CreateControlCollection ();
+		}
+#endif		
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void OnInit (EventArgs e)
+		{
+			Page.RegisterViewStateHandler ();
+
+			base.OnInit (e);
+		}
+
+#if NET_2_0
+		[MonoTODO("Probably something about validators here")]
+		protected internal override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender(e);
+		}
+#endif		
+
+		protected override void RenderAttributes (HtmlTextWriter w)
+		{
+			/* Need to always render: name, method, action
+			 * and id
+			 */
+
+			string action = Page.Request.FilePath;
+			string query = Page.Request.QueryStringRaw;
+			if (query != null && query.Length > 0) {
+				action += "?" + query;
+			}
+			
+			w.WriteAttribute ("name", Name);
+			w.WriteAttribute ("method", Method);
+			w.WriteAttribute ("action", action);
+
+			if (ID == null) {
+				/* If ID != null then HtmlControl will
+				 * write the id attribute
+				 */
+				w.WriteAttribute ("id", ClientID);
+				Attributes.Remove ("id");
+			}
+
+			string submit = Page.GetSubmitStatements ();
+			if (submit != null && submit != "")
+				w.WriteAttribute ("onsubmit", submit);
+			
+			/* enctype and target should not be written if
+			 * they are empty
+			 */
+			string enctype = Enctype;
+			if (enctype != null && enctype != "") {
+				w.WriteAttribute ("enctype", enctype);
+			}
+
+			string target = Target;
+			if (target != null && target != "") {
+				w.WriteAttribute ("target", target);
+			}
+			
+			/* Now remove them from the hash so the base
+			 * RenderAttributes can do all the rest
+			 */
+			Attributes.Remove ("name");
+			Attributes.Remove ("method");
+			Attributes.Remove ("enctype");
+			Attributes.Remove ("target");
+
+			base.RenderAttributes (w);
+		}
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void RenderChildren (HtmlTextWriter w)
+		{
+			Page.OnFormRender (w, ClientID);
+			base.RenderChildren (w);
+			Page.OnFormPostRender (w, ClientID);
+		}
+
+#if NET_2_0
+		/* According to corcompare */
+		[MonoTODO]
+		public override void RenderControl (HtmlTextWriter w)
+		{
+			base.RenderControl (w);
+		}
+#endif		
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void Render (HtmlTextWriter w)
+		{
+			base.Render (w);
+		}
+	}
+}
+
+	

+ 191 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs

@@ -0,0 +1,191 @@
+//
+// System.Web.UI.HtmlControls.HtmlImage.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.ComponentModel;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls 
+{
+	[ControlBuilder (typeof (HtmlControlBuilder))]
+	public class HtmlImage : HtmlControl 
+	{
+		public HtmlImage () : base ("img")
+		{
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Align 
+		{
+			get {
+				string align = Attributes["align"];
+
+				if (align == null) {
+					return (String.Empty);
+				}
+				
+				return (align);
+			}
+			set {
+				/* Validate: left, center, right, top,
+				 * middle, bottom?
+				 */
+				if (value == null) {
+					Attributes.Remove ("align");
+				} else {
+					Attributes["align"] = value;
+				}
+			}
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Alt 
+		{
+			get {
+				string alt = Attributes["alt"];
+
+				if (alt == null) {
+					return (String.Empty);
+				}
+				
+				return (alt);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("alt");
+				} else {
+					Attributes["alt"] = value;
+				}
+			}
+		}
+	
+		[DefaultValue (0)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int Border 
+		{
+			get {
+				string border = Attributes["border"];
+				
+				if (border == null) {
+					return (-1);
+				} else {
+					return (Int32.Parse (border, CultureInfo.InvariantCulture));
+				}
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("border");
+				} else {
+					Attributes["border"] = value.ToString ();
+				}
+			}
+		}
+
+		[DefaultValue (100)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int Height
+		{
+			get {
+				string height = Attributes["height"];
+				
+				if (height == null) {
+					return (-1);
+				} else {
+					return (Int32.Parse (height, CultureInfo.InvariantCulture));
+				}
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("height");
+				} else {
+					Attributes["height"] = value.ToString ();
+				}
+			}
+		}
+		
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Src 
+		{
+			get {
+				string src = Attributes["src"];
+
+				if (src == null) {
+					return (String.Empty);
+				}
+				
+				return (src);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("src");
+				} else {
+					Attributes["src"] = value;
+				}
+			}
+		}
+
+		[DefaultValue (100)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int Width 
+		{
+			get {
+				string width = Attributes["width"];
+
+				if (width == null) {
+					return (-1);
+				}
+				else {
+					return (Int32.Parse (width, CultureInfo.InvariantCulture));
+				}
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("width");
+				} else {
+					Attributes["width"] = value.ToString ();
+				}
+			}
+		}
+
+		protected override void RenderAttributes (HtmlTextWriter w)
+		{
+			PreProcessRelativeReference (w, "src");
+			base.RenderAttributes (w);
+
+			/* MS closes the HTML element at the end of
+			 * the attributes too, according to the nunit
+			 * tests
+			 */
+			w.Write (" /");
+		}
+	}
+}
+
+	

+ 136 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs

@@ -0,0 +1,136 @@
+//
+// System.Web.UI.HtmlControls.HtmlInputCheckBox.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.ComponentModel;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls 
+{
+	[DefaultEvent ("ServerChange")]
+	public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler
+	{
+		public HtmlInputCheckBox () : base ("checkbox")
+		{
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+#if NET_2_0
+		//[TypeConverter (typeof(System.Web.UI.MinimizableAttributeTypeConverter))]
+#endif
+		public bool Checked
+		{
+			get {
+				string check = Attributes["checked"];
+
+				if (check == null) {
+					return (false);
+				}
+
+				return (true);
+			}
+			set {
+				if (value == false) {
+					Attributes.Remove ("checked");
+				} else {
+					Attributes["checked"] = "checked";
+				}
+			}
+		}
+		
+		private static readonly object EventServerChange = new object ();
+		
+		public event EventHandler ServerChange
+		{
+			add {
+				Events.AddHandler (EventServerChange, value);
+			}
+			remove {
+				Events.RemoveHandler (EventServerChange, value);
+			}
+		}
+
+#if NET_2_0
+		protected internal
+#else
+		protected
+#endif
+		override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+
+			if (Page != null) {
+				Page.RegisterRequiresPostBack (this);
+			}
+		}
+
+		protected virtual void OnServerChange (EventArgs e)
+		{
+			EventHandler handler = (EventHandler)Events[EventServerChange];
+
+			if (handler != null) {
+				handler (this, e);
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected virtual void RaisePostDataChangeEvent ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif
+		
+		bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			string postedValue = postCollection[postDataKey];
+			bool postedBool = ((postedValue != null) &&
+					   (postedValue.Length > 0));
+
+			if (Checked != postedBool) {
+				Checked = postedBool;
+				return (true);
+			}
+			
+			return (false);
+		}
+
+		void IPostBackDataHandler.RaisePostDataChangedEvent ()
+		{
+			OnServerChange (EventArgs.Empty);
+		}
+	}
+}
+
+	

+ 181 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs

@@ -0,0 +1,181 @@
+//
+// System.Web.UI.HtmlControls.HtmlInputFile.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.HtmlControls 
+{
+	[ValidationProperty ("Value")]
+	public class HtmlInputFile : HtmlInputControl , IPostBackDataHandler
+	{
+		public HtmlInputFile () : base ("file")
+		{
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Accept 
+		{
+			get {
+				string acc = Attributes["accept"];
+
+				if (acc == null) {
+					return (String.Empty);
+				}
+
+				return (acc);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("accept");
+				} else {
+					Attributes["accept"] = value;
+				}
+			}
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int MaxLength 
+		{
+			get {
+				string maxlen = Attributes["maxlength"];
+				
+				if (maxlen == null) {
+					return (-1);
+				} else {
+					return (Convert.ToInt32 (maxlen));
+				}
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("maxlength");
+				} else {
+					Attributes["maxlength"] = value.ToString ();
+				}
+			}
+		}
+
+		HttpPostedFile posted_file;
+		
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public HttpPostedFile PostedFile 
+		{
+			get {
+				return (posted_file);
+			}
+		}
+		
+#if NET_2_0
+		[DefaultValue ("-1")]
+#else
+		[DefaultValue ("")]
+#endif
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int Size 
+		{
+			get {
+				string size = Attributes["size"];
+				
+				if (size == null) {
+					return (-1);
+				} else {
+					return (Convert.ToInt32 (size));
+				}
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("size");
+				} else {
+					Attributes["size"] = value.ToString ();
+				}
+			}
+		}
+		
+		[Browsable (false)]
+		public override string Value 
+		{
+			get {
+				string value = Attributes["value"];
+
+				if (value == null) {
+					return (String.Empty);
+				}
+				
+				return (value);
+			}
+			set {
+				throw new NotSupportedException ();
+			}
+		}
+
+#if NET_2_0
+		protected internal
+#else
+		protected
+#endif		
+		override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+
+			if (Page != null) {
+				Page.RegisterRequiresPostBack (this);
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected virtual void RaisePostDataChangedEvent ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif		
+		
+		bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			posted_file = Page.Request.Files [postDataKey];
+			
+			return (false);
+		}
+
+		void IPostBackDataHandler.RaisePostDataChangedEvent ()
+		{
+			/* No events to raise */
+		}
+	}
+}
+
+	

+ 729 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs

@@ -0,0 +1,729 @@
+//
+// System.Web.UI.HtmlControls.HtmlSelect.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.Util;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls 
+{
+	[DefaultEvent ("ServerChange")]
+	[ValidationProperty ("Value")]
+	[ControlBuilder (typeof (HtmlSelectBuilder))]
+	public class HtmlSelect : HtmlContainerControl , IPostBackDataHandler
+#if NET_2_0
+	, IParserAccessor
+#endif
+	{
+		public HtmlSelect () : base ("select")
+		{
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public virtual string DataMember 
+		{
+			get {
+				string member = Attributes["datamember"];
+
+				if (member == null) {
+					return (String.Empty);
+				}
+
+				return (member);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("datamember");
+				} else {
+					Attributes["datamember"] = value;
+				}
+			}
+		}
+
+		object datasource;
+		
+		[DefaultValue (null)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public virtual object DataSource 
+		{
+			get {
+				return (datasource);
+			}
+			set {
+				if ((value != null) &&
+				    !(value is IEnumerable) &&
+				    !(value is IListSource)) {
+					throw new ArgumentException ();
+				}
+
+				datasource = value;
+			}
+		}
+
+#if NET_2_0
+		[DefaultValue ("")]
+		public virtual string DataSourceID
+		{
+			get {
+				return (String.Empty);
+			}
+			set {
+			}
+		}
+#endif
+				
+
+		[DefaultValue ("")]
+		public virtual string DataTextField 
+		{
+			get {
+				string text = Attributes["datatextfield"];
+
+				if (text == null) {
+					return (String.Empty);
+				}
+
+				return (text);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("datatextfield");
+				} else {
+					Attributes["datatextfield"] = value;
+				}
+			}
+		}
+
+		[DefaultValue ("")]
+		public virtual string DataValueField 
+		{
+			get {
+				string value = Attributes["datavaluefield"];
+
+				if (value == null) {
+					return (String.Empty);
+				}
+
+				return (value);
+			}
+			set {
+				if (value == null) {
+					Attributes.Remove ("datavaluefield");
+				} else {
+					Attributes["datavaluefield"] = value;
+				}
+			}
+		}
+
+		public override string InnerHtml 
+		{
+			get {
+				throw new NotSupportedException ();
+			}
+			set {
+				throw new NotSupportedException ();
+			}
+		}
+
+		public override string InnerText
+		{
+			get {
+				throw new NotSupportedException ();
+			}
+			set {
+				throw new NotSupportedException ();
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected bool IsBoundUsingDataSourceID 
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+#endif		
+
+		ListItemCollection items;
+		
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		public ListItemCollection Items 
+		{
+			get {
+				if (items == null) {
+					items = new ListItemCollection ();
+				}
+
+				return (items);
+			}
+		}
+
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public bool Multiple 
+		{
+			get {
+				string multi = Attributes["multiple"];
+
+				if (multi == null) {
+					return (false);
+				}
+
+				return (true);
+			}
+			set {
+				if (value == false) {
+					Attributes.Remove ("multiple");
+				} else {
+					Attributes["multiple"] = "multiple";
+				}
+			}
+		}
+		
+		[DefaultValue ("")]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Name 
+		{
+			get {
+				return (UniqueID);
+			}
+			set {
+				/* Do nothing */
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected bool RequiresDataBinding 
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[Browsable (false)]
+		public virtual int SelectedIndex 
+		{
+			get {
+				/* Make sure Items has been initialised */
+				ListItemCollection listitems = Items;
+
+				for (int i = 0; i < listitems.Count; i++) {
+					if (listitems[i].Selected) {
+						return (i);
+					}
+				}
+
+				/* There is always a selected item in
+				 * non-multiple mode, if the size is
+				 * <= 1
+				 */
+				if (!Multiple && Size <= 1) {
+					/* Select the first item */
+					if (listitems.Count > 0) {
+						/* And make it stick
+						 * if there is
+						 * anything in the
+						 * list
+						 */
+						listitems[0].Selected = true;
+					}
+					
+					return (0);
+				}
+				
+				return (-1);
+			}
+			set {
+				ClearSelection ();
+
+				if (value == -1 || items == null) {
+					return;
+				}
+
+				if (value < 0 || value >= items.Count) {
+					throw new ArgumentOutOfRangeException ("value");
+				}
+
+				items[value].Selected = true;
+			}
+		}
+
+		/* "internal infrastructure" according to the docs,
+		 * but has some documentation in 2.0
+		 */
+		protected virtual int[] SelectedIndices
+		{
+			get {
+				ArrayList selected = new ArrayList ();
+
+				int count = Items.Count;
+
+				for (int i = 0; i < count; i++) {
+					if (Items [i].Selected) {
+						selected.Add (i);
+					}
+				}
+				
+				return ((int[])selected.ToArray (typeof (int)));
+			}
+		}
+		
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public int Size 
+		{
+			get {
+				string size = Attributes["size"];
+
+				if (size == null) {
+					return (-1);
+				}
+
+				return (Int32.Parse (size, CultureInfo.InvariantCulture));
+			}
+			set {
+				if (value == -1) {
+					Attributes.Remove ("size");
+				} else {
+					Attributes["size"] = value.ToString ();
+				}
+			}
+		}
+
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public string Value 
+		{
+			get {
+				int sel = SelectedIndex;
+
+				if (sel >= 0 && sel < Items.Count) {
+					return (Items[sel].Value);
+				}
+				
+				return (String.Empty);
+			}
+			set {
+				int sel = Items.IndexOf (value);
+
+				if (sel >= 0) {
+					SelectedIndex = sel;
+				}
+			}
+		}
+
+		private static readonly object EventServerChange = new object ();
+		
+		public event EventHandler ServerChange
+		{
+			add {
+				Events.AddHandler (EventServerChange, value);
+			}
+			remove {
+				Events.RemoveHandler (EventServerChange, value);
+			}
+		}
+
+		protected override void AddParsedSubObject (object obj)
+		{
+			if (!(obj is ListItem)) {
+				throw new HttpException ("HtmlSelect can only contain ListItem");
+			}
+
+			Items.Add ((ListItem)obj);
+			
+			base.AddParsedSubObject (obj);
+		}
+
+		/* "internal infrastructure" according to the docs,
+		 * but has some documentation in 2.0
+		 */
+		protected virtual void ClearSelection ()
+		{
+			if (items == null) {
+				return;
+			}
+
+			int count = items.Count;
+			for (int i = 0; i < count; i++) {
+				items[i].Selected = false;
+			}
+		}
+		
+		protected override ControlCollection CreateControlCollection ()
+		{
+			return (base.CreateControlCollection ());
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected void EnsureDataBound ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected virtual IEnumerable GetData ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif		
+
+		protected override void LoadViewState (object savedState)
+		{
+			object first = null;
+			object second = null;
+			int[] selected = null;
+
+			Triplet triplet = savedState as Triplet;
+			if (triplet != null) {
+				first = triplet.First;
+				second = triplet.Second;
+				selected = triplet.Third as int[];
+			}
+
+			base.LoadViewState (first);
+
+			if (second != null) {
+				IStateManager manager = Items as IStateManager;
+				manager.LoadViewState (second);
+			}
+
+			if (selected != null) {
+				Select (selected);
+			}
+		}
+
+		protected override void OnDataBinding (EventArgs e)
+		{
+			base.OnDataBinding (e);
+
+			/* Make sure Items has been initialised */
+			ListItemCollection listitems = Items;
+
+			listitems.Clear ();
+			
+			IEnumerable list = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
+
+			if (list == null) {
+				return;
+			}
+			
+			foreach (object container in list) {
+				string text = null;
+				string value = null;
+
+				if (DataTextField == String.Empty &&
+				    DataValueField == String.Empty) {
+					text = container.ToString ();
+					value = text;
+				} else {
+					if (DataTextField != String.Empty) {
+						text = DataBinder.Eval (container, DataTextField).ToString ();
+					}
+
+					if (DataValueField != String.Empty) {
+						value = DataBinder.Eval (container, DataValueField).ToString ();
+					} else {
+						value = text;
+					}
+
+					if (text == null &&
+					    value != null) {
+						text = value;
+					}
+				}
+
+				if (text == null) {
+					text = String.Empty;
+				}
+				if (value == null) {
+					value = String.Empty;
+				}
+
+				ListItem item = new ListItem (text, value);
+				listitems.Add (item);
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected virtual void OnDataPropertyChanged ()
+		{
+			RequiresDataBinding = true;
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected virtual void OnDataSourceViewChanged (object sender,
+								EventArgs e)
+		{
+			RequiresDataBinding = true;
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected internal override void OnInit (EventArgs e)
+		{
+/*
+			if (IsViewStateEnabled == false &&
+			    Page.IsPostBack == true) {
+				RequiresDataBinding = true;
+			}
+*/
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected internal override void OnLoad (EventArgs e)
+		{
+			throw new NotImplementedException ();
+		}
+#endif		
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+
+			if (Page != null) {
+				Page.RegisterRequiresPostBack (this);
+			}
+		}
+
+		protected virtual void OnServerChange (EventArgs e)
+		{
+			EventHandler handler = (EventHandler)Events[EventServerChange];
+
+			if (handler != null) {
+				handler (this, e);
+			}
+		}
+		
+		protected override void RenderAttributes (HtmlTextWriter w)
+		{
+			/* If there is no "name" attribute,
+			 * LoadPostData doesn't work...
+			 */
+			w.WriteAttribute ("name", Name);
+			Attributes.Remove ("name");
+			
+			/* Don't render the databinding attributes */
+			Attributes.Remove ("datamember");
+			Attributes.Remove ("datatextfield");
+			Attributes.Remove ("datavaluefield");
+			
+			base.RenderAttributes (w);
+		}
+		
+#if NET_2_0
+		protected internal
+#else
+		protected
+#endif		
+		override void RenderChildren (HtmlTextWriter w)
+		{
+			base.RenderChildren (w);
+
+			if (items == null) {
+				return;
+			}
+			
+			w.WriteLine ();
+
+			bool done_sel = false;
+			
+			int count = items.Count;
+			for (int i = 0; i < count; i++) {
+				ListItem item = items[i];
+
+				w.Indent++;
+				
+				/* Write the <option> elements this
+				 * way so that the output HTML matches
+				 * the ms version (can't make
+				 * HtmlTextWriterTag.Option an inline
+				 * element, cos that breaks other
+				 * stuff.)
+				 */
+				w.WriteBeginTag ("option");
+				if (item.Selected && !done_sel) {
+
+					w.WriteAttribute ("selected", "selected");
+
+					if (!Multiple) {
+						done_sel = true;
+					}
+				}
+				
+				w.WriteAttribute ("value", item.Value);
+				w.Write (HtmlTextWriter.TagRightChar);
+				
+				w.Write (item.Text);
+				w.WriteEndTag ("option");
+				w.WriteLine ();
+
+				w.Indent--;
+			}
+		}
+
+		protected override object SaveViewState ()
+		{
+			object first = null;
+			object second = null;
+			object selected = null;
+
+			first = base.SaveViewState ();
+
+			IStateManager manager = items as IStateManager;
+			if (manager != null) {
+				second = manager.SaveViewState ();
+			}
+
+			selected = SelectedIndices;
+			
+			if (first == null &&
+			    second == null &&
+			    selected == null) {
+				return (null);
+			}
+
+			return (new Triplet (first, second, selected));
+		}
+
+		/* "internal infrastructure" according to the docs,
+		 * but has some documentation in 2.0
+		 */
+		protected virtual void Select (int[] selectedIndices)
+		{
+			if (items == null) {
+				return;
+			}
+
+			ClearSelection ();
+			
+			int count = items.Count;
+			foreach (int i in selectedIndices) {
+				if (i >= 0 && i < count) {
+					items[i].Selected = true;
+				}
+			}
+		}
+
+		protected override void TrackViewState ()
+		{
+			base.TrackViewState ();
+
+			IStateManager manager = items as IStateManager;
+			if (manager != null) {
+				manager.TrackViewState ();
+			}
+		}
+
+#if NET_2_0
+		protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection) 
+		{
+			return (LoadPostData (postDataKey, postCollection));
+		}
+
+		protected virtual void RaisePostDataChangedEvent ()
+		{
+			RaisePostDataChangedEvent ();
+		}
+#endif
+
+		bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			/* postCollection contains the values that are
+			 * selected
+			 */
+
+			string[] values = postCollection.GetValues (postDataKey);
+			bool changed = false;
+
+			if (values != null) {
+				if (Multiple) {
+					/* We have a set of
+					 * selections.  We can't just
+					 * set the new list, because
+					 * we need to know if the set
+					 * has changed from last time
+					 */
+					int value_len = values.Length;
+					int[] old_sel = SelectedIndices;
+					int[] new_sel = new int[value_len];
+					int old_sel_len = old_sel.Length;
+					
+					for (int i = 0; i < value_len; i++) {
+						new_sel[i] = Items.IndexOf (values[i]);
+						if (old_sel_len != value_len ||
+						    old_sel[i] != new_sel[i]) {
+							changed = true;
+						}
+					}
+
+					if (changed) {
+						Select (new_sel);
+					}
+				} else {
+					/* Just take the first one */
+					int sel = Items.IndexOf (values[0]);
+
+					if (sel != SelectedIndex) {
+						SelectedIndex = sel;
+						changed = true;
+					}
+				}
+			}
+			
+			return (changed);
+		}
+
+		void IPostBackDataHandler.RaisePostDataChangedEvent ()
+		{
+			OnServerChange (EventArgs.Empty);
+		}
+		
+	}
+}

+ 43 - 0
mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs

@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.BorderStyle.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.
+//
+
+namespace System.Web.UI.WebControls {
+	[Serializable]
+	public enum BorderStyle {
+		NotSet,
+		None,
+		Dotted,
+		Dashed,
+		Solid,
+		Double,
+		Groove,
+		Ridge,
+		Inset,
+		Outset
+	}
+}

+ 126 - 0
mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs

@@ -0,0 +1,126 @@
+//
+// System.Web.UI.WebControls.BoundColumn.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+	public class BoundColumn : DataGridColumn
+	{
+
+		private string data_format_string;
+
+		public BoundColumn ()
+		{
+		}
+
+		public static readonly string thisExpr = "!";
+
+		[DefaultValue("")]
+		public virtual string DataField 
+		{
+			get {
+				return ViewState.GetString ("DataField", String.Empty);
+			}
+			set {
+				ViewState ["DataField"] = value;
+			}
+		}
+		
+		[DefaultValue("")]
+		public virtual string DataFormatString 
+		{
+			get {
+				return ViewState.GetString ("DataFormatString", String.Empty);
+			}
+			set {
+				ViewState ["DataFormatString"] = value;
+			}
+		}
+
+		[DefaultValue(false)]
+		public virtual bool ReadOnly 
+		{
+			get {
+				return ViewState.GetBool ("ReadOnly", false);
+			}
+			set {
+				ViewState ["ReadOnly"] = value;
+			}
+		}
+		
+		public override void Initialize ()
+		{
+			data_format_string = DataFormatString;
+		}
+
+		public override void InitializeCell (TableCell cell, int columnIndex,
+				ListItemType itemType)
+		{
+			base.InitializeCell (cell, columnIndex, itemType);
+
+			switch (itemType) {
+			case ListItemType.Item:
+			case ListItemType.EditItem:
+			case ListItemType.AlternatingItem:
+				cell.DataBinding += new EventHandler (ItemDataBinding);
+				break;
+			}
+		}
+
+		protected virtual string FormatDataValue (object dataValue)
+		{
+			if (data_format_string == String.Empty)
+				return dataValue.ToString ();
+
+			return String.Format (data_format_string, dataValue);
+		}
+
+		private void ItemDataBinding (object sender, EventArgs e)
+		{
+			TableCell cell = (TableCell) sender;
+			DataGridItem item  = (DataGridItem) cell.NamingContainer;
+			object value = null;
+			string text = null;
+
+			if (DataField != thisExpr) {
+				try {
+					value = DataBinder.Eval (item.DataItem, DataField);
+				} catch {
+					value = String.Empty;
+				}
+			} else {
+				value = item.DataItem;
+			}
+
+			text = FormatDataValue (value);
+			if (text == String.Empty)
+				text = "&nbsp;";
+			cell.Text = text;
+		}
+	}
+}

+ 148 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs

@@ -0,0 +1,148 @@
+//
+// System.Web.UI.WebControls.ButtonColumn.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+	public class ButtonColumn : DataGridColumn {
+		       
+		[DefaultValue(ButtonColumnType.LinkButton)]
+		[Description("The type of button contained within the column.")]
+		public virtual ButtonColumnType ButtonType
+		{
+			get {
+				return (ButtonColumnType) ViewState.GetInt ("LinkButton",
+						(int) ButtonColumnType.LinkButton);
+			}
+			set {
+				ViewState ["LinkButton"] = value;
+			}
+		}
+		
+		[DefaultValue("")]
+		[Description("The command associated with the button.")]
+		public virtual string CommandName
+		{
+			get {
+				return ViewState.GetString ("CommandName", String.Empty);
+			}
+			set {
+				ViewState ["CommandName"] = value;
+			}
+		}
+
+		[DefaultValue("")]
+		[Description("The field bound to the text property of the button.")]
+		public virtual string DataTextField 
+		{
+			get {
+				return ViewState.GetString ("DataTextField", String.Empty);
+			}
+			set {
+				ViewState ["DataTextField"] = value;
+			}
+		}
+		
+		[DefaultValue("")]
+		[Description("The formatting applied to the value bound to the Text property.")]
+		public virtual string DataTextFormatString 
+		{
+			get {
+				return ViewState.GetString ("DataTextFormatString",
+						String.Empty);
+			}
+			set {
+				ViewState ["DataTextFormatString"] = value;
+			}
+		}
+
+		[DefaultValue("")]
+		[Description("The text used for the button.")]
+		public virtual string Text 
+		{
+			get {
+				return ViewState.GetString ("Text", String.Empty);
+			}
+			set {
+				ViewState ["Text"] = value;
+			}
+		}
+		
+		public override void Initialize ()
+		{
+			/* No documentation for this method, so it's
+			 * only here to keep corcompare quiet
+			 */
+			base.Initialize ();
+		}
+
+		public override void InitializeCell (TableCell cell,
+						     int columnIndex,
+						     ListItemType itemType)
+		{
+			base.InitializeCell (cell, columnIndex, itemType);
+
+			if (itemType != ListItemType.Header &&
+			    itemType != ListItemType.Footer) {
+				switch (ButtonType) {
+				case ButtonColumnType.LinkButton: 
+				{
+					LinkButton butt = new LinkButton ();
+					
+					butt.Text = Text;
+					butt.CommandName = CommandName;
+
+					cell.Controls.Add (butt);
+				}
+				break;
+
+				case ButtonColumnType.PushButton: 
+				{
+					Button butt = new Button ();
+					
+					butt.Text = Text;
+					butt.CommandName = CommandName;
+
+					cell.Controls.Add (butt);
+				}
+				break;
+			
+				}
+			}
+		}
+
+		protected virtual string FormatDataTextValue (object dataTextValue)
+		{
+			if (DataTextFormatString == String.Empty)
+				return dataTextValue.ToString ();
+
+			return String.Format (DataTextFormatString, dataTextValue);
+		}
+	}
+}

+ 394 - 0
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs

@@ -0,0 +1,394 @@
+//
+// System.Web.UI.WebControls.CheckBox.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.Web.UI;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+	[Designer ("System.Web.UI.Design.WebControls.CheckBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+	[DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+	[DefaultEvent ("CheckedChanged")]
+	[DefaultProperty ("Text")]
+#if NET_2_0
+	[ControlValueProperty ("Checked", null)]
+#endif		
+	public class CheckBox : WebControl, IPostBackDataHandler
+#if NET_2_0
+	, ICheckBoxControl
+#endif
+	{
+		string render_type;
+		
+		public CheckBox () : base (HtmlTextWriterTag.Input)
+		{
+			render_type = "checkbox";
+		}
+
+		internal CheckBox (string render_type) : base (HtmlTextWriterTag.Input)
+		{
+			this.render_type = render_type;
+		}
+
+		[DefaultValue (false)]
+#if NET_2_0
+		[Themeable (false)]
+#endif		
+		public virtual bool AutoPostBack 
+		{
+			get {
+				return (ViewState.GetBool ("AutoPostBack",
+							   false));
+			}
+			set {
+				ViewState["AutoPostBack"] = value;
+			}
+		}
+
+#if NET_2_0
+		[DefaultValue (false)]
+		[Themeable (false)]
+		[MonoTODO]
+		public virtual bool CausesValidation 
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif		
+		
+
+		[DefaultValue (false)]
+#if NET_2_0
+		[Bindable (true, BindingDirection.TwoWay)]
+		[Themeable (false)]
+#else		
+		[Bindable (true)]
+#endif		
+		public virtual bool Checked 
+		{
+			get {
+				return (ViewState.GetBool ("Checked", false));
+			}
+			set {
+				ViewState["Checked"] = value;
+			}
+		}
+
+#if NET_2_0
+		[Browsable (false)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[MonoTODO]
+		public AttributeCollection InputAttributes 
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[Browsable (false)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		[MonoTODO]
+		public AttributeCollection LabelAttributes
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif		
+
+		[DefaultValue ("")]
+		[Bindable (true)]
+#if NET_2_0
+		[Localizable (true)]
+#endif		
+		public virtual string Text 
+		{
+			get {
+				return (ViewState.GetString ("Text",
+							     String.Empty));
+			}
+			set {
+				ViewState["Text"] = value;
+			}
+		}
+
+		[DefaultValue (TextAlign.Right)]
+#if ONLY_1_1
+		[Bindable (true)]
+#endif		
+		public virtual TextAlign TextAlign
+		{
+			get {
+				object o = ViewState["TextAlign"];
+
+				if (o == null) {
+					return (TextAlign.Right);
+				} else {
+					return ((TextAlign)o);
+				}
+			}
+			set {
+				if (value != TextAlign.Left &&
+				    value != TextAlign.Right) {
+					throw new ArgumentOutOfRangeException ("value");
+				}
+				
+				ViewState["TextAlign"] = value;
+			}
+		}
+
+#if NET_2_0
+		[Themeable (false)]
+		[DefaultValue ("")]
+		[MonoTODO]
+		public string ValidationGroup
+		{
+			get {
+				throw new NotImplementedException ();
+			}
+			set {
+				throw new NotImplementedException ();
+			}
+		}
+#endif		
+
+		private static readonly object EventCheckedChanged = new object ();
+		public event EventHandler CheckedChanged 
+		{
+			add {
+				Events.AddHandler (EventCheckedChanged, value);
+			}
+			remove {
+				Events.RemoveHandler (EventCheckedChanged, value);
+			}
+		}
+
+		protected virtual void OnCheckedChanged (EventArgs e)
+		{
+			EventHandler handler = (EventHandler)Events[EventCheckedChanged];
+			
+			if (handler != null) {
+				handler (this, e);
+			}
+		}
+
+		internal virtual string NameAttribute 
+		{
+			get {
+				return (this.UniqueID);
+			}
+		}
+		
+		protected override void AddAttributesToRender (HtmlTextWriter w)
+		{
+			if (Page != null)
+				Page.VerifyRenderingInServerForm (this);
+
+			/* This is a nasty kludge to avoid rendering
+			 * "style" and the ControlStyle in checkboxes
+			 * (we use a surrounding <span> instead), but
+			 * still pass the unit test that shows the
+			 * style being rendered in multiple calls to
+			 * Render () (which means we can't just delete
+			 * Attributes["style"] or ControlStyle.Reset()
+			 * in Render ())
+			 */
+			string css_style = Attributes ["style"];
+			if (css_style != null) {
+				Attributes.Remove ("style");
+			}
+
+			Style style = new Style ();
+			if (ControlStyleCreated) {
+				style.CopyFrom (ControlStyle);
+				ControlStyle.Reset ();
+			}
+			
+			base.AddAttributesToRender (w);
+
+			if (css_style != null) {
+				Attributes ["style"] = css_style;
+			}
+			if (!style.IsEmpty) {
+				ApplyStyle (style);
+			}
+			
+			InternalAddAttributesToRender (w);
+			
+			w.AddAttribute (HtmlTextWriterAttribute.Type,
+					render_type);
+			w.AddAttribute (HtmlTextWriterAttribute.Name,
+					NameAttribute);
+			
+			if (AutoPostBack) {
+				w.AddAttribute (HtmlTextWriterAttribute.Onclick, Page.GetPostBackClientHyperlink (this, ""));
+			}
+
+			if (Checked) {
+				w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected override void LoadViewState (object savedState)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override object SaveViewState ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void TrackViewState ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif		
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+
+			if (Page != null) {
+				Page.RegisterRequiresPostBack (this);
+			}
+		}
+
+		void RenderLabel (HtmlTextWriter w)
+		{
+			if (Text.Length > 0) {
+				w.AddAttribute (HtmlTextWriterAttribute.For, ClientID);
+				w.RenderBeginTag (HtmlTextWriterTag.Label);
+				w.Write (this.Text);
+				w.RenderEndTag ();
+			}
+		}
+		
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void Render (HtmlTextWriter w)
+		{
+			bool control_style = false;
+			
+			/* Need to apply the styles around the text
+			 * label too
+			 */
+			if (ControlStyleCreated) {
+				ControlStyle.AddAttributesToRender (w, this);
+				w.RenderBeginTag (HtmlTextWriterTag.Span);
+
+				control_style = true;
+			} else if (Attributes ["style"] != null) {
+				/* TODO: check if this or the style
+				 * has precendence, or if they should
+				 * be merged (if I can figure out how
+				 * to turn a CssStyleCollection into a
+				 * Style)
+				 */
+				CssStyleCollection style = Attributes.CssStyle;
+				
+				w.AddAttribute (HtmlTextWriterAttribute.Style,
+						style.BagToString ());
+				w.RenderBeginTag (HtmlTextWriterTag.Span);
+
+				control_style = true;
+			}
+			
+			if (TextAlign == TextAlign.Left) {
+				RenderLabel (w);
+				base.Render (w);
+			} else {
+				base.Render (w);
+				RenderLabel (w);
+			}
+
+			if (control_style) {
+				w.RenderEndTag ();
+			}
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected virtual void RaisePostDataChangedEvent ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif
+
+		bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			string postedValue = postCollection[postDataKey];
+			bool postedBool = ((postedValue != null) &&
+					   (postedValue.Length > 0));
+			
+			if (Checked != postedBool) {
+				Checked = postedBool;
+				return (true);
+			}
+
+			return (false);
+		}
+
+		void IPostBackDataHandler.RaisePostDataChangedEvent ()
+		{
+			OnCheckedChanged (EventArgs.Empty);
+		}
+
+		internal virtual void InternalAddAttributesToRender (HtmlTextWriter w)
+		{
+		}
+	}
+}

+ 385 - 0
mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs

@@ -0,0 +1,385 @@
+//
+// System.Web.UI.WebControls.DataGridColumn.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+	[TypeConverter (typeof (System.ComponentModel.ExpandableObjectConverter))]
+	public abstract class DataGridColumn : IStateManager
+	{
+		DataGrid owner;
+		StateBag viewstate;
+		bool tracking_viewstate;
+		bool design;
+
+		TableItemStyle footer_style;
+		TableItemStyle header_style;
+		TableItemStyle item_style;
+		
+		public DataGridColumn ()
+		{
+			viewstate = new StateBag ();
+		}
+		
+		[DefaultValue (null)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+		[PersistenceMode (PersistenceMode.InnerProperty)]
+		public virtual TableItemStyle FooterStyle 
+		{
+			get {
+				if (footer_style == null) {
+					footer_style = new TableItemStyle ();
+
+					if (tracking_viewstate) {
+						footer_style.TrackViewState ();
+					}
+				}
+
+				return (footer_style);
+			}
+		}
+		
+		[DefaultValue ("")]
+		public virtual string FooterText 
+		{
+			get {
+				return (viewstate.GetString ("FooterText",
+							     String.Empty));
+			}
+			set {
+				viewstate["FooterText"] = value;
+			}
+		}
+
+		[DefaultValue ("")]
+		public virtual string HeaderImageUrl
+		{
+			get {
+				return (viewstate.GetString ("HeaderImageUrl",
+							     String.Empty));
+			}
+			set {
+				viewstate["HeaderImageUrl"] = value;
+			}
+		}
+		
+		[DefaultValue (null)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+		[PersistenceMode (PersistenceMode.InnerProperty)]
+		public virtual TableItemStyle HeaderStyle 
+		{
+			get {
+				if (header_style == null) {
+					header_style = new TableItemStyle ();
+
+					if (tracking_viewstate) {
+						header_style.TrackViewState ();
+					}
+				}
+
+				return (header_style);
+			}
+		}
+
+		[DefaultValue ("")]
+		public virtual string HeaderText 
+		{
+			get {
+				return (viewstate.GetString ("HeaderText",
+							     String.Empty));
+			}
+			set {
+				viewstate["HeaderText"] = value;
+			}
+		}
+		
+		[DefaultValue (null)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+		[PersistenceMode (PersistenceMode.InnerProperty)]
+		public virtual TableItemStyle ItemStyle 
+		{
+			get {
+				if (item_style == null) {
+					item_style = new TableItemStyle ();
+
+					if (tracking_viewstate) {
+						item_style.TrackViewState ();
+					}
+				}
+
+				return (item_style);
+			}
+		}
+		
+		[DefaultValue ("")]
+		public virtual string SortExpression 
+		{
+			get {
+				return (viewstate.GetString ("SortExpression",
+							     String.Empty));
+			}
+			set {
+				viewstate["SortExpression"] = value;
+			}
+		}
+
+		[DefaultValue (true)]
+		public bool Visible 
+		{
+			get {
+				return (viewstate.GetBool ("Visible",
+							   true));
+			}
+			set {
+				viewstate["Visible"] = value;
+			}
+		}
+
+		public virtual void Initialize ()
+		{
+			if (owner != null && owner.Site != null) {
+				design = owner.Site.DesignMode;
+			}
+		}
+
+		public virtual void InitializeCell (TableCell cell,
+						    int columnIndex,
+						    ListItemType itemType)
+		{
+			switch (itemType) {
+			case ListItemType.Header: 
+			{
+				/* If sorting is enabled, add a
+				 * LinkButton or an ImageButton
+				 * (depending on HeaderImageUrl).
+				 *
+				 * If sorting is disabled, the
+				 * HeaderText or an Image is displayed
+				 * (depending on HeaderImageUrl).
+				 *
+				 * If neither HeaderText nor
+				 * HeaderImageUrl is set, use &nbsp;
+				 */
+				bool sort = false;
+				string sort_ex = SortExpression;
+				
+				if (owner != null &&
+				    sort_ex.Length > 0) {
+					sort = owner.AllowSorting;
+				}
+				
+				string image_url = HeaderImageUrl;
+				if (image_url.Length > 0) {
+					if (sort) {
+						ImageButton butt = new ImageButton ();
+
+						/* Don't need to
+						 * resolve this, Image
+						 * does that when it
+						 * renders
+						 */
+						butt.ImageUrl = image_url;
+						butt.CommandName = "Sort";
+						butt.CommandArgument = sort_ex;
+
+						cell.Controls.Add (butt);
+					} else {
+						Image image = new Image ();
+
+						image.ImageUrl = image_url;
+
+						cell.Controls.Add (image);
+					}
+				} else {
+					if (sort) {
+						LinkButton link = new LinkButton ();
+
+						link.Text = HeaderText;
+						link.CommandName = "Sort";
+						link.CommandArgument = sort_ex;
+
+						cell.Controls.Add (link);
+					} else {
+						string text = HeaderText;
+						if (text.Length > 0) {
+							cell.Text = text;
+						} else {
+							cell.Text = "&nbsp;";
+						}
+					}
+				}
+			}
+			break;
+
+			case ListItemType.Footer:
+			{
+				/* Display FooterText or &nbsp; */
+				string text = FooterText;
+
+				if (text.Length > 0) {
+					cell.Text = text;
+				} else {
+					cell.Text = "&nbsp;";
+				}
+			}
+			break;
+
+			default:
+				break;
+				
+			}
+			
+		}
+
+		public override string ToString ()
+		{
+			return (String.Empty);
+		}
+
+		protected bool DesignMode 
+		{
+			get {
+				return (design);
+			}
+		}
+		
+		protected DataGrid Owner 
+		{
+			get {
+				return (owner);
+			}
+		}
+
+		internal void Set_Owner (DataGrid value) 
+		{
+			owner = value;
+		}
+		
+		
+		protected StateBag ViewState 
+		{
+			get {
+				return (viewstate);
+			}
+		}
+
+		/* There are no events defined for DataGridColumn, so no
+		 * idea what this method is supposed to do
+		 */
+		protected virtual void OnColumnChanged ()
+		{
+		}
+		
+		void IStateManager.LoadViewState (object savedState)
+		{
+			LoadViewState (savedState);
+		}
+
+		object IStateManager.SaveViewState ()
+		{
+			return (SaveViewState ());
+		}
+
+		void IStateManager.TrackViewState ()
+		{
+			TrackViewState ();
+		}
+
+		bool IStateManager.IsTrackingViewState
+		{
+			get {
+				return (IsTrackingViewState);
+			}
+		}
+
+		protected virtual void LoadViewState (object savedState)
+		{
+			object[] pieces = savedState as object[];
+
+			if (pieces == null) {
+				return;
+			}
+
+			if (pieces[0] != null) {
+				viewstate.LoadViewState (pieces[0]);
+			}
+			if (pieces[1] != null) {
+				FooterStyle.LoadViewState (pieces[1]);
+			}
+			if (pieces[2] != null) {
+				HeaderStyle.LoadViewState (pieces[2]);
+			}
+			if (pieces[3] != null) {
+				ItemStyle.LoadViewState (pieces[3]);
+			}
+		}
+
+		protected virtual object SaveViewState ()
+		{
+			object[] res = new object[4];
+
+			res[0] = viewstate.SaveViewState ();
+
+			if (footer_style != null) {
+				res[1] = footer_style.SaveViewState ();
+			}
+			if (header_style != null) {
+				res[2] = header_style.SaveViewState ();
+			}
+			if (item_style != null) {
+				res[3] = item_style.SaveViewState ();
+			}
+
+			return (res);
+		}
+
+		protected virtual void TrackViewState ()
+		{
+			tracking_viewstate = true;
+			
+			viewstate.TrackViewState ();
+			if (footer_style != null) {
+				footer_style.TrackViewState ();
+			}
+			if (header_style != null) {
+				header_style.TrackViewState ();
+			}
+			if (item_style != null) {
+				item_style.TrackViewState ();
+			}
+		}
+
+		protected bool IsTrackingViewState 
+		{
+			get {
+				return (tracking_viewstate);
+			}
+		}
+	}
+}

+ 109 - 0
mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs

@@ -0,0 +1,109 @@
+//
+// System.Web.UI.WebControls.RadioButton.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+	[Designer ("System.Web.UI.Design.WebControls.CheckBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+	public class RadioButton : CheckBox , IPostBackDataHandler
+	{
+		public RadioButton () : base ("radio")
+		{
+		}
+
+		[DefaultValue ("")]
+#if NET_2_0
+		[Themeable (false)]
+#endif
+		public virtual string GroupName
+		{
+			get {
+				return (ViewState.GetString ("GroupName",
+							     String.Empty));
+			}
+			set {
+				ViewState["GroupName"] = value;
+			}
+		}
+
+		internal override string NameAttribute 
+		{
+			get {
+				return (GroupName);
+			}
+		}
+
+		internal override void InternalAddAttributesToRender (HtmlTextWriter w)
+		{
+			base.InternalAddAttributesToRender (w);
+			w.AddAttribute (HtmlTextWriterAttribute.Value, this.UniqueID);
+		}
+
+#if NET_2_0
+		protected internal
+#else		
+		protected
+#endif		
+		override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+		}
+
+#if NET_2_0
+		[MonoTODO]
+		protected override bool LoadPostData (string postDataKey, NameValueCollection postCollection) 
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void RaisePostDataChangedEvent ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif		
+
+		bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+		{
+			bool old_checked = Checked;
+			
+			if (postCollection[GroupName] == postDataKey) {
+				Checked = true;
+			} else {
+				Checked = false;
+			}
+
+			if (old_checked != Checked) {
+				return (true);
+			} else {
+				return (false);
+			}
+		}
+	}
+}

+ 35 - 0
mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs

@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.TextAlign.cs
+//
+// Author:
+//      Dick Porter  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.
+//
+
+namespace System.Web.UI.WebControls {
+	[Serializable]
+	public enum TextAlign {
+		Left = 0x01,
+		Right
+	}
+}

+ 190 - 0
mcs/class/System.Web/System.Web/HttpPostedFile.cs

@@ -0,0 +1,190 @@
+//
+// System.Web.HttpPostedFile.cs
+//
+// Author:
+//	Dick Porter  <[email protected]>
+//      Ben Maurer   <[email protected]>
+//      Miguel de Icaza <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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.IO;
+
+namespace System.Web
+{
+	public sealed class HttpPostedFile {
+		string name;
+		string content_type;
+		Stream stream;
+
+		
+		class ReadSubStream : Stream {
+			Stream s;
+			long offset;
+			long length;
+	
+			public ReadSubStream (Stream s, long offset, long length)
+			{
+				this.s = s;
+				this.offset = offset;
+				this.length = length;
+			}
+	
+			public override void Flush ()
+			{
+			}
+	
+			public override int Read (byte [] buffer, int dest_offset, int count)
+			{
+				if (dest_offset < 0)
+					throw new ArgumentOutOfRangeException ("dest_offset", "< 0");
+				if (count < 0)
+					throw new ArgumentOutOfRangeException ("count", "< 0");
+				if (dest_offset > length)
+					throw new ArgumentException ("destination offset is beyond array size");
+				// reordered to avoid possible integer overflow
+				if (dest_offset > length - count)
+					throw new ArgumentException ("Reading would overrun buffer");
+
+				return s.Read (buffer, dest_offset, count);
+			}
+	
+			public override int ReadByte ()
+			{
+				if (Position == Length - 1)
+					return -1;
+				return s.ReadByte ();
+			}
+	
+			public override long Seek (long d, SeekOrigin origin)
+			{
+				long real;
+				switch (origin) {
+				case SeekOrigin.Begin:
+					real = offset + d;
+					break;
+				case SeekOrigin.End:
+					real = offset + length - d;
+					break;
+				case SeekOrigin.Current:
+					real = s.Position + d;
+					break;
+				default:
+					throw new ArgumentException ();
+				}
+
+				long virt = real - offset;
+				if (virt < 0 || virt >= length)
+					throw new ArgumentException ();
+
+				return s.Seek (real, SeekOrigin.Begin) - offset;
+			}
+	
+			public override void SetLength (long value)
+			{
+				throw new NotSupportedException ();
+			}
+
+			public override void Write (byte [] buffer, int offset, int count)
+			{
+				throw new NotSupportedException ();
+			}
+
+			public override bool CanRead {
+				get { return true; }
+			}
+			public override bool CanSeek {
+				get { return true; }
+			}
+			public override bool CanWrite {
+				get { return false; }
+			}
+	
+			public override long Length {
+				get { return length; }
+			}
+	
+			public override long Position {
+				get {
+					return s.Position - offset;
+				}
+				set {
+					Seek (Position, SeekOrigin.Begin);
+				}
+			}
+		}
+
+		internal HttpPostedFile (string name, string content_type, Stream base_stream, long offset, long length)
+		{
+			this.name = name;
+			this.content_type = content_type;
+			this.stream = new ReadSubStream (base_stream, offset, length);
+		}
+		
+		public string ContentType {
+			get {
+				return (content_type);
+			}
+		}
+
+		public int ContentLength {
+			get {
+		  		return (int)stream.Length;
+			}
+		}
+
+		public string FileName 
+		{
+			get {
+				return (name);
+			}
+		}
+
+		public Stream InputStream 
+		{
+			get {
+				return (stream);
+			}
+		}
+
+		public void SaveAs (string filename)
+		{
+			byte [] buffer = new byte [16*1024];
+			long old_post = stream.Position;
+
+			try {
+				File.Delete (filename);
+				using (FileStream fs = File.Create (filename)){
+					stream.Position = 0;
+					int n;
+					
+					while ((n = stream.Read (buffer, 0, 16*1024)) != 0){
+						fs.Write (buffer, 0, n);
+					}
+				}
+			} finally {
+				stream.Position = old_post;
+			}
+		}
+	}
+}