2005-08-04 Ben Maurer <bmaurer@ximian.com>
authorBen Maurer <benm@mono-cvs.ximian.com>
Fri, 26 Aug 2005 22:27:41 +0000 (22:27 -0000)
committerBen Maurer <benm@mono-cvs.ximian.com>
Fri, 26 Aug 2005 22:27:41 +0000 (22:27 -0000)
* CalendarTest.cs: Test based on an msdn example. Again, I (heart)
anonymous methods.

2005-08-03  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfoTest.cs: Test for copying from base control

* WebControlTest.cs: Issue I found while doing repeatinfo

* LabelTest.cs: New tests.

* PanelTest.cs: New tests

2005-07-30  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfoTest.auto.cs: Regen.

* RepeatInfoTest.gen.cs: Autogenerate tests for 0 items

2005-07-26  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfoTest.cs: Remove tests that are contained below

* RepeatInfoTest.auto.cs: Generated tests.

* RepeatInfoTest.gen.cs: A test generator for repeatinfo

2005-07-20  Ben Maurer  <bmaurer@ximian.com>

* DropDownListTest.cs (InitialSelectionMade): Add a test for a
regression that seems to be caused by some change to
ListItemCollection. Add this file to sources as all tests other
than this pass using the old impl of ddl except for this, which is
a regression.

2005-07-19  Ben Maurer  <bmaurer@ximian.com>

* UnitConverterTest.cs: New tests

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* FontUnitTest.cs: Make it run on msft

2005-08-05  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: Option is rendered as a block.

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: I fixed the nested indents

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: Enable some indentation tests, others
need to be disabled

2005-07-12  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: Enable some tests

2005-07-11  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: The style attr thing below seems to be a
2.0 ism. Add tests for indentation.

2005-07-11  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: Add a test for popping end tags working
correctly.

* ToolboxDataAttributeTest.cs: Don't depend on the way that hash
values are generated. Also, use built strings rather than stuff
from ldstr to make the test a bit stronger.

* PropertyConverterTest.cs: Make this pass on MSFT 1.1

2005-07-08  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: Update notworking

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriterTest.cs: More tests.

2005-08-04  Ben Maurer  <bmaurer@ximian.com>

* HttpContext.cs: Kill a NIE.

2005-07-30  Ben Maurer  <bmaurer@ximian.com>

* HtmlForm.cs: Make sure we actually put the "?" in the url

2005-08-05  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Revert the patch below, see test case

2005-08-03  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Optmize this not to do insane amounts of
allocation for large pages, etc.

2005-07-29  Ben Maurer  <bmaurer@ximian.com>

* StateBag.cs: Don't remove when tracking viewstate, as per msft
docs.

2005-07-29  Ben Maurer  <bmaurer@ximian.com>

* StateBag.cs: Actually *remove* items that are null. Duh.

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Fix nested indentation

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Fix indentation (somewhat at least)

2005-07-17  Ben Maurer  <bmaurer@ximian.com>

* AttributeCollection.cs: Use the invariant culture.

* StateBag.cs: "Duh" optimization: return null when there are no
dirty items in the view state

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* StateBag.cs: A "short" version of my favorite method.

* HtmlTextWriter.cs: New method to get the tag name staticly.

2005-07-13  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Remove debugging spew. Style cleanup

2005-07-12  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Make styles work.

2005-07-11  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Missing a PopEndTag here.

* PropertyConverter.cs: Pass tests

2005-07-08  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Much better compliance with msft

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* StateBag.cs: Noticed an issue where SetDirty was called when the
key did not exist.

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* StateBag.cs: Add a method that gets a string or else a default
value.

2005-07-06  Ben Maurer  <bmaurer@ximian.com>

* HtmlTextWriter.cs: Make sure to clear attributes when they are
written.

* StateBag.cs: New impl

2005-07-15  Ben Maurer  <bmaurer@ximian.com>

* DataSourceHelper.cs: Obsolete

* DataSourceResolver.cs: Moved from DataSourceHelper.

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* DataSourceHelper.cs: Helper method used for data binding.

2005-08-04  Ben Maurer  <bmaurer@ximian.com>

* LinkButton.cs: Fix up the test suite here.

* Panel.cs: Fix up nowrap

2005-08-03  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Finally figured out how to use base control

2005-07-31  Ben Maurer  <bmaurer@ximian.com>

* TextBox.cs: Html encode for multiline text boxes

* HyperLink.cs: Resolve images

2005-07-30  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Handle 0 items situations correctly

* HyperLink.cs: Resolve urls correctly

* CheckBox.cs: use the correct ID for the label element.

* Label.cs: Correct AddParsedSubObject impl. See FAQ

2005-07-29  Ben Maurer  <bmaurer@ximian.com>

* Label.cs: ClientID should be used rather than UniqueID to get
the For attribute

2005-07-29  Ben Maurer  <bmaurer@ximian.com>

* RadioButton.cs: The "remove from groupstate" isn't needed any
more, now that statebag is correct.

2005-07-28  Ben Maurer  <bmaurer@ximian.com>

* CompositeControl.cs: Stub

2005-07-25  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: WOOHOOO! all tests pass. Boy is this class
cracktastic.

2005-07-25  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: If the repeater has one column, the separators
are rendered on a different line

2005-07-25  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Split the horiz and vertical cases, because this
class has rules that are beyond strange. Continue working to make
my tests work.

2005-07-25  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Misc fixes for my test suite.

2005-07-22  Ben Maurer  <bmaurer@ximian.com>

* HyperLink.cs: Handle non-literal children.

2005-07-21  Ben Maurer  <bmaurer@ximian.com>

* Label.cs: SP1 stuff

2005-07-21  Ben Maurer  <bmaurer@ximian.com>

* TextBoxMode.cs: Wrong ordering of enum...

2005-07-21  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Fix most of the tests.

2005-07-20  Ben Maurer  <bmaurer@ximian.com>

* SelectedDatesCollection.cs: Apprarently, I don't write code well
at 1 am.

* Repeater.cs: Uh, actually add stuff to the items collection
 (thanks sp ;-)

2005-07-20  Ben Maurer  <bmaurer@ximian.com>

* DataGridColumnCollection.cs: New impl

* TemplateColumn.cs: New impl

2005-07-19  Ben Maurer  <bmaurer@ximian.com>

* FontUnit.cs: Corcompare fixes

* UnitConverter.cs: Fix api diffs

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* ListControl.cs: Fix api differences

2005-07-18  Ben Maurer  <bmaurer@ximian.com>

* TextBox.cs: Finish this up.

* AdRotator.cs: Fix issues in the test suite. Minor style
cleanups.

* Repeater.cs: Fix a bug where the datasource is null and we do
the binding

* WebColorConverter.cs: Optimize by not doing a concat on a
formatted string.

2005-07-17  Ben Maurer  <bmaurer@ximian.com>

* ListItemCollection.cs: Multiple uses of equals rather than
string.compare as below. Remove unreachable code warning.

* WebColorConverter.cs (ConvertTo): Use the == operator on string
rather than an invariant non-case ignoring compare. They are
exactly the same thing. Use proper coding style in this method.

* WebControl.cs: Return null when saving the view state if there
is no state in any of the things we save. This creates a fairly
large savings, because we can avoid saving anything about many
levels of deaply nested controls.

2005-07-15  Ben Maurer  <bmaurer@ximian.com>

* Repeater.cs (DoItem): Add the DataItem before we call user
methods, as it seems to be there with msft.

2005-07-15  Ben Maurer  <bmaurer@ximian.com>

* Repeater.cs (DoItem): We need to .Add the control *before* we
data bind it so that the state gets tracked correctly. Fixes the
postback test case.

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* WebControl.cs:
  - Some optimizations
    * Don't use enum formatting stuff, it is 1) expensive 2) does
      allocations. Use a new method in HtmlControl to do the right
      formatting.
    * Don't use Enum.IsDefined but an explicit check.
    * (x == "" || x.Length < 2) is not needed since "".Length == 0 < 2
  - Use the correct coding style.

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* Repeater.cs: Cleanup; use the DataSourceHelper thingy.

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* Repeater.cs: Get it working

2005-07-14  Ben Maurer  <bmaurer@ximian.com>

* Repeater.cs: The beginnings of this control

2005-07-13  Ben Maurer  <bmaurer@ximian.com>

* RepeaterItem.cs: Compile fix

* RepeaterItemCollection.cs: New file

* RepeaterItem.cs: get OnBubbleEvent right.

2005-07-13  Ben Maurer  <bmaurer@ximian.com>

* RepeaterItem.cs: Stub

2005-07-13  Ben Maurer  <bmaurer@ximian.com>

* RepeatInfo.cs: Impl.

2005-07-12  Ben Maurer  <bmaurer@ximian.com>

* ListItem.cs: New impl.

2005-07-12  Ben Maurer  <bmaurer@ximian.com>

* TextBox.cs: Passwords seem 1) not to be rendered to the client
if set, 2) not kept in view state (for security reasons...)

* LinkButton.cs:
* Button.cs: Page.Validate () if needed. Gets the validator tests
working again.

* TextBox.cs: Properties to get the validator stuff to work.

2005-07-11  Ben Maurer  <bmaurer@ximian.com>

* LinkButton.cs:
* Button.cs: Bubble the Command event.

2005-07-11  Ben Maurer  <bmaurer@ximian.com>

* Button.cs:
  - Clean up style (with my wonderful state bag hack!)
  - Fix a view state typo.
  - Use AddAttributesToRender
  - Don't add an extra <span>

2005-07-09  Ben Maurer  <bmaurer@ximian.com>

* TextBox.cs: More work on this

2005-07-09  Ben Maurer  <bmaurer@ximian.com>

* TextBox.cs: Add the work I did on this today. It's not complete
yet, but its a start!

2005-07-08  Ben Maurer  <bmaurer@ximian.com>

* LinkButton.cs: Command impl

2005-07-08  Ben Maurer  <bmaurer@ximian.com>

* LinkButton.cs: Initial impl

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* PlaceHolderControlBuilder.cs: new file

* LabelControlBuilder.cs: New file

* HyperLink.cs: use control builder; fix parsing stuff

* HyperLinkControlBuilder.cs: new file

* Panel.cs: misc fixes

2005-07-07  Ben Maurer  <bmaurer@ximian.com>

* PlaceHolder.cs: New file. Seems to do nothing

* Label.cs: Use my new statebag trick to reduce typing

* HyperLink.cs: New file

2005-07-06  Ben Maurer  <bmaurer@ximian.com>

* Unit.cs: cctor not needed; static fields are 0 init'd by default

* WebControl.cs: Kothari & Datye's book explains how these work.

* IRepeatInfoUser.cs: Reimpl.

svn path=/trunk/mcs/; revision=48921

31 files changed:
mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/Pair.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/StateBag.cs [new file with mode: 0644]

diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
new file mode 100644 (file)
index 0000000..87cc6a2
--- /dev/null
@@ -0,0 +1,31 @@
+// 
+// System.Web.UI.WebControls.AdCreatedEventHandler
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       public delegate void AdCreatedEventHandler (object sender, AdCreatedEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
new file mode 100644 (file)
index 0000000..f242192
--- /dev/null
@@ -0,0 +1,334 @@
+// 
+// System.Web.UI.WebControls.AdRotator
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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.Xml;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+       [DefaultEvent("AdCreated")]
+       [DefaultProperty("AdvertisementFile")]
+       [Designer("System.Web.UI.Design.WebControls.AdRotatorDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+#if NET_2_0
+       [ToolboxData("<{0}:AdRotator runat=\"server\"></{0}:AdRotator>")]
+#else
+       [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" Width=\"468px\"></{0}:AdRotator>")]
+#endif         
+       public class AdRotator :
+#if NET_2_0
+       DataBoundControl
+#else          
+       WebControl
+#endif 
+       {
+       
+               protected override ControlCollection CreateControlCollection ()
+               {
+                       return new EmptyControlCollection (this);
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected internal override void OnInit (EventArgs e)
+               {
+                       base.OnInit(e);
+               }
+#endif
+               
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void OnPreRender (EventArgs eee)
+               {
+                       Hashtable ht = null;
+                       
+                       if (ad_file != "" && ad_file != null) {
+                               ReadAdsFromFile (Page.MapPath (ad_file));
+                               ht = ChooseAd ();
+                       }
+
+                       AdCreatedEventArgs e = new AdCreatedEventArgs (ht);
+                       OnAdCreated (e);
+                       createdargs = e;
+                       
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected internal override void PerformDataBinding (IEnumerable data)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected override void PerformSelect ()
+               {
+                       throw new NotImplementedException ();
+               }
+#endif         
+
+               AdCreatedEventArgs createdargs;
+
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void Render (HtmlTextWriter w)
+               {
+                       AdCreatedEventArgs e = createdargs;
+
+                       base.AddAttributesToRender (w);
+                       
+                       if (e.NavigateUrl != null)
+                               w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveUrl (e.NavigateUrl));
+                       w.AddAttribute (HtmlTextWriterAttribute.Target, Target);
+                       
+                       w.RenderBeginTag (HtmlTextWriterTag.A);
+
+                       if (e.NavigateUrl != null)
+                               w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (e.ImageUrl));
+                       
+                       w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
+                       w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+                       w.RenderBeginTag (HtmlTextWriterTag.Img);
+                       w.RenderEndTag (); // img
+                       w.RenderEndTag (); // a
+               }
+
+               //
+               // We take all the ads in the ad file and add up their
+               // impression weight. We then take a random number [0,
+               // TotalImpressions). We then choose the ad that is
+               // that number or less impressions for the beginning
+               // of the file. This lets us respect the weights
+               // given.
+               //
+               Hashtable ChooseAd ()
+               {
+                       // cache for performance
+                       string KeywordFilter = this.KeywordFilter;
+                       
+                       int total_imp = 0;
+                       int cur_imp = 0;
+                       
+                       foreach (Hashtable a in ads) {
+                               if (KeywordFilter == "" || KeywordFilter == (string) a ["Keyword"])
+                                       total_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
+                       }
+
+                       int r = new Random ().Next (total_imp);
+
+                       foreach (Hashtable a in ads) {
+                               if (KeywordFilter != "" && KeywordFilter != (string) a ["Keyword"])
+                                       continue;
+                               cur_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
+                               
+                               if (cur_imp > r)
+                                       return a;
+                       }
+
+                       if (total_imp != 0)
+                               throw new Exception ("I should only get here if no ads matched");
+                       
+                       return null;
+               }
+
+               ArrayList ads = new ArrayList ();
+               
+               void ReadAdsFromFile (string s)
+               {
+                       XmlDocument d = new XmlDocument ();
+                       try {
+                               d.Load (s);
+                       } catch (Exception e) {
+                               throw new HttpException ("AdRotator could not parse the xml file", e);
+                       }
+                       
+                       ads.Clear ();
+                       
+                       foreach (XmlNode n in d.DocumentElement.ChildNodes) {
+
+                               Hashtable ad = new Hashtable ();
+                               
+                               foreach (XmlNode nn in n.ChildNodes)
+                                       ad.Add (nn.Name, nn.InnerText);
+                               
+                               ads.Add (ad);
+                       }
+               }
+               
+               string ad_file = "";
+
+#if NET_2_0
+               [UrlProperty]
+#endif         
+               [Bindable(true)]
+               [DefaultValue("")]
+               [Editor("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+               public string AdvertisementFile {
+                       get {
+                               return ad_file;
+                       }
+                       set {
+                               ad_file = value;
+                       }
+                       
+               }
+
+#if NET_2_0
+               [DefaultValue ("AlternateText")]
+               [MonoTODO]
+               public string AlternateTextField 
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif         
+               
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public override FontInfo Font {
+                       get {
+                               return base.Font;
+                       }
+               }
+
+#if NET_2_0
+               [DefaultValue ("ImageUrl")]
+               [MonoTODO]
+               public string ImageUrlField 
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif         
+               
+
+               [Bindable(true)]
+               [DefaultValue("")]
+               public string KeywordFilter {
+                       get {
+                               return ViewState.GetString ("KeywordFilter", "");
+                       }
+                       set {
+                               ViewState ["KeywordFilter"] = value;
+                       }
+                       
+               }
+
+#if NET_2_0
+               [DefaultValue ("NavigateUrl")]
+               [MonoTODO]
+               public string NavigateUrlField 
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               /* listed in corcompare */
+               [MonoTODO]
+               public override Page Page 
+               {
+                       get {
+                               return base.Page;
+                       }
+                       set {
+                               base.Page = value;
+                       }
+               }
+#endif         
+               
+               [Bindable(true)]
+               [DefaultValue("_top")]
+               [TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))]
+               public string Target {
+                       get {
+                               return ViewState.GetString ("Target", "_top");
+                       }
+                       set {
+                               ViewState ["Target"] = value;
+                       }
+                       
+               }
+
+#if NET_2_0
+               /* all these are listed in corcompare */
+               [MonoTODO]
+               public override string UniqueID
+               {
+                       get {
+                               return base.UniqueID;
+                       }
+               }
+
+               [MonoTODO]
+               protected override HtmlTextWriterTag TagKey 
+               {
+                       get {
+                               return base.TagKey;
+                       }
+               }
+
+               [MonoTODO]
+               protected override StateBag ViewState 
+               {
+                       get {
+                               return base.ViewState;
+                       }
+               }
+#endif         
+       
+               protected virtual void OnAdCreated (AdCreatedEventArgs e)
+               {
+                       AdCreatedEventHandler h = (AdCreatedEventHandler) Events [AdCreatedEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+               static readonly object AdCreatedEvent = new object ();
+               public event AdCreatedEventHandler AdCreated {
+                       add { Events.AddHandler (AdCreatedEvent, value); }
+                       remove { Events.RemoveHandler (AdCreatedEvent, value); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
new file mode 100644 (file)
index 0000000..9c68d1c
--- /dev/null
@@ -0,0 +1,154 @@
+//
+// System.Web.UI.WebControls.DataGridColumnCollection
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+       public sealed class DataGridColumnCollection : ICollection, IStateManager {
+               public DataGridColumnCollection (DataGrid owner, ArrayList columns)
+               {
+                       this.owner = owner;
+                       this.columns = columns;
+               }
+       
+       
+               public void Add (DataGridColumn column)
+               {
+                       columns.Add (column);
+                       column.Set_Owner (owner);
+               }
+       
+               public void AddAt (int index, DataGridColumn column)
+               {
+                       columns.Insert (index, column);
+                       column.Set_Owner (owner);
+               }
+       
+               public void Clear ()
+               {
+                       columns.Clear ();
+               }
+       
+               public void CopyTo (Array array, int index)
+               {
+                       columns.CopyTo (array, index);
+               }
+       
+               public IEnumerator GetEnumerator ()
+               {
+                       return columns.GetEnumerator ();
+               }
+       
+               public int IndexOf (DataGridColumn column)
+               {
+                       return columns.IndexOf (column);
+               }
+
+               [Obsolete ("figure out what you need with me")]
+               internal void OnColumnsChanged ()
+               {
+                       // Do something
+               }
+       
+               public void Remove (DataGridColumn column)
+               {
+                       columns.Remove (column);
+               }
+       
+               public void RemoveAt (int index)
+               {
+                       columns.RemoveAt (index);
+               }
+       
+               void System.Web.UI.IStateManager.LoadViewState (object savedState)
+               {
+                       object [] o = (object []) savedState;
+                       if (o == null)
+                               return;
+
+                       int i = 0;
+                       foreach (IStateManager ism in this)
+                               ism.LoadViewState (o [i++]);
+               }
+       
+               object System.Web.UI.IStateManager.SaveViewState ()
+               {
+                       object [] o = new object [Count];
+
+                       int i = 0;
+                       foreach (IStateManager ism in this)
+                               o [i++] = ism.SaveViewState ();
+
+                       foreach (object a in o)
+                               if (a != null)
+                                       return o;
+                       return null;
+               }
+       
+               void System.Web.UI.IStateManager.TrackViewState ()
+               {
+                       track = true;
+                       foreach (IStateManager ism in this)
+                               ism.TrackViewState ();
+               }
+
+               [Browsable(false)]
+               public int Count {
+                       get { return columns.Count; }
+               }
+       
+               bool IStateManager.IsTrackingViewState {
+                       get { return track; }
+               }
+       
+               [Browsable(false)]
+               public bool IsReadOnly {
+                       get { return columns.IsReadOnly; }
+               }
+       
+               [Browsable(false)]
+               public bool IsSynchronized {
+                       get { return columns.IsSynchronized; }  
+               }
+
+               [Browsable(false)]
+               public DataGridColumn this [int index] {
+                       get { return (DataGridColumn) columns [index]; }
+               }
+
+               [Browsable(false)]
+               public object SyncRoot {
+                       get { return columns.SyncRoot; }
+               }
+       
+               DataGrid owner;
+               ArrayList columns;
+               bool track;
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
new file mode 100644 (file)
index 0000000..b885840
--- /dev/null
@@ -0,0 +1,180 @@
+//
+// System.Web.UI.WebControls.Label.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+//
+// 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.Web.UI;
+
+namespace System.Web.UI.WebControls {
+       [ControlBuilder(typeof(HyperLinkControlBuilder))]
+       [DataBindingHandler("System.Web.UI.Design.HyperLinkDataBindingHandler, " + Consts.AssemblySystem_Design)]
+       [ParseChildren (false)]
+#if NET_2_0
+       [ToolboxData("<{0}:HyperLink runat=\"server\">HyperLink</{0}:HyperLink>")]
+#else          
+       [ToolboxData("<{0}:HyperLink runat=server>HyperLink</{0}:HyperLink>")]
+#endif         
+       [DefaultProperty("Text")]
+       [Designer("System.Web.UI.Design.WebControls.HyperLinkDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       public class HyperLink : WebControl {
+
+               public HyperLink () : base (HtmlTextWriterTag.A)
+               {
+               }
+                               
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       base.AddAttributesToRender (w);
+                       // add attributes - only if they're not empty
+                       string s = NavigateUrl;
+                       if (s.Length > 0)
+                               w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveUrl (s));
+                       s = Target;
+                       if (s.Length > 0)
+                               w.AddAttribute (HtmlTextWriterAttribute.Target, s);
+               }
+               
+               protected override void AddParsedSubObject (object obj)
+               {
+                       if (HasControls ()) {
+                               base.AddParsedSubObject (obj);
+                               return;
+                       }
+                       
+                       LiteralControl lc = obj as LiteralControl;
+
+                       if (lc == null) {
+                               string s = Text;
+                               if (s.Length != 0) {
+                                       Text = null;
+                                       Controls.Add (new LiteralControl (s));
+                               }
+                               base.AddParsedSubObject (obj);
+                       } else {
+                               Text = lc.Text;
+                       }
+               }
+               
+
+               [MonoTODO ("Why override?")]
+               protected override void LoadViewState (object savedState)
+               {
+                       base.LoadViewState (savedState);
+               }
+               
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void RenderContents (HtmlTextWriter w) 
+               {
+                       if (HasControls ())
+                               base.RenderContents (w);
+                       else if (ImageUrl != "") {
+                               w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (ImageUrl));
+#if NET_2_0
+                               string s = Text;
+                               if (s.Length > 0)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Alt, s);
+                               w.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
+#else
+                               w.AddAttribute (HtmlTextWriterAttribute.Alt, Text);
+                               w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+#endif
+                               w.RenderBeginTag (HtmlTextWriterTag.Img);
+                               w.RenderEndTag ();
+                       } else {
+                               w.Write (Text);
+                       }
+                       
+               }
+
+               [Bindable(true)]
+               [DefaultValue("")]
+               [Editor("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+#if NET_2_0
+               [UrlProperty]
+#endif         
+               public virtual string ImageUrl {
+                       get {
+                               return ViewState.GetString ("ImageUrl", "");
+                       }
+                       set {
+                               ViewState ["ImageUrl"] = value;
+                       }       
+               }
+               
+               [Bindable(true)]
+               [DefaultValue("")]
+               [Editor("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+#if NET_2_0
+               [UrlProperty]
+#endif         
+               public string NavigateUrl {
+                       get {
+                               return ViewState.GetString ("NavigateUrl", "");
+                       }
+                       set {
+                               ViewState ["NavigateUrl"] = value;
+                       }       
+               }
+               
+#if ONLY_1_1
+               [Bindable(true)]
+#endif         
+               [DefaultValue("")]
+               [TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))]
+               public string Target {
+                       get {
+                               return ViewState.GetString ("Target", "");
+                       }
+                       set {
+                               ViewState ["Target"] = value;
+                       }
+               }
+               
+               [Bindable(true)]
+               [DefaultValue("")]
+               [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
+#if NET_2_0
+               [Localizable (true)]
+#endif         
+               public virtual string Text {
+                       get {
+                               return ViewState.GetString ("Text", "");
+                       }
+                       set {
+                               ViewState ["Text"] = value;
+                               if (HasControls ())
+                                       Controls.Clear ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
new file mode 100644 (file)
index 0000000..be011d4
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.HyperLinkControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class HyperLinkControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
new file mode 100644 (file)
index 0000000..3348d9a
--- /dev/null
@@ -0,0 +1,49 @@
+// 
+// System.Web.UI.WebControls.IRepeatInfoUser
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       
+       public interface IRepeatInfoUser {
+       
+               Style GetItemStyle (ListItemType itemType, int repeatIndex);
+               void RenderItem (WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer);
+       
+               bool HasFooter {
+                       get;
+               }
+               bool HasHeader {
+                       get;
+               }
+               bool HasSeparators {
+                       get;
+               }
+               int RepeatedItemCount {
+                       get;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
new file mode 100644 (file)
index 0000000..88fdf23
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.LabelControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class LabelControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
new file mode 100644 (file)
index 0000000..7420431
--- /dev/null
@@ -0,0 +1,299 @@
+//
+// System.Web.UI.WebControls.LinkButton.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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 {
+       [ControlBuilder(typeof(LinkButtonControlBuilder))]
+       [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+       [DefaultEvent("Click")]
+       [DefaultProperty("Text")]
+       [Designer("System.Web.UI.Design.WebControls.LinkButtonDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       [ParseChildren(false)]
+#if NET_2_0
+       [ToolboxData("<{0}:LinkButton runat=\"server\">LinkButton</{0}:LinkButton>")]
+#else          
+       [ToolboxData("<{0}:LinkButton runat=server>LinkButton</{0}:LinkButton>")]
+#endif         
+       public class LinkButton : WebControl, IPostBackEventHandler
+#if NET_2_0
+       , IButtonControl
+#endif
+       {
+       
+               public LinkButton () : base (HtmlTextWriterTag.A) 
+               {
+               }
+       
+       
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (Page != null)
+                               Page.VerifyRenderingInServerForm (this);
+
+                       base.AddAttributesToRender (w);
+                       if (Page == null)
+                               return;
+                       
+                       if (CausesValidation && Page.AreValidatorsUplevel ()) {
+                               ClientScriptManager csm = new ClientScriptManager (Page);
+                               w.AddAttribute (HtmlTextWriterAttribute.Href,
+                                               String.Format ("javascript:{{if (typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) {0};}}",
+                                                              csm.GetPostBackEventReference (this, String.Empty)));
+                               w.AddAttribute ("language", "javascript");
+                       } else {
+                               w.AddAttribute (HtmlTextWriterAttribute.Href, Page.GetPostBackClientHyperlink (this, ""));
+                       }
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected virtual void RaisePostBackEvent (string eventArgument)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif         
+               
+               void IPostBackEventHandler.RaisePostBackEvent (string ea)
+               {
+                       if (CausesValidation)
+#if NET_2_0
+                               Page.Validate (ValidationGroup);
+#else
+                               Page.Validate ();
+#endif
+                       
+                       OnClick (EventArgs.Empty);
+                       OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+               }
+
+               protected override void AddParsedSubObject (object obj)
+               {
+                       if (HasControls ()) {
+                               base.AddParsedSubObject (obj);
+                               return;
+                       }
+                       
+                       LiteralControl lc = obj as LiteralControl;
+
+                       if (lc == null) {
+                               string s = Text;
+                               if (s.Length != 0) {
+                                       Text = null;
+                                       Controls.Add (new LiteralControl (s));
+                               }
+                               base.AddParsedSubObject (obj);
+                       } else {
+                               Text = lc.Text;
+                       }
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected virtual PostBackOptions GetPostBackOptions ()
+               {
+                       throw new NotImplementedException ();
+               }
+#endif         
+
+               protected override void LoadViewState (object savedState)
+               {
+                       base.LoadViewState (savedState);
+
+                       // Make sure we clear child controls when this happens
+                       if (ViewState ["Text"] != null)
+                               Text = (string) ViewState ["Text"];
+               }
+
+               [MonoTODO ("Why override?")]
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void OnPreRender (EventArgs e)
+               {
+                       base.OnPreRender (e);
+               }
+       
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void RenderContents (HtmlTextWriter writer)
+               {
+                       if (HasControls ())
+                               base.RenderContents (writer);
+                       else
+                               writer.Write (Text);
+               }
+       
+       
+#if ONLY_1_1
+               [Bindable(false)]
+#endif         
+               [DefaultValue(true)]
+#if NET_2_0
+               [Themeable (false)]
+               public virtual
+#else
+               public
+#endif         
+               bool CausesValidation {
+                       get {
+                               return ViewState.GetBool ("CausesValidation", true);
+                       }
+                       set {
+                               ViewState ["CausesValidation"] = value;
+                       }
+               
+               }
+
+               [Bindable(true)]
+               [DefaultValue("")]
+#if NET_2_0
+               [Themeable (false)]
+               public virtual
+#else          
+               public
+#endif         
+               string CommandArgument {
+                       get {
+                               return ViewState.GetString ("CommandArgument", "");
+                       }
+                       set {
+                               ViewState ["CommandArgument"] = value;
+                       }
+               }
+
+               [DefaultValue("")]
+#if NET_2_0
+               [Themeable (false)]
+               public virtual
+#else          
+               public
+#endif         
+               string CommandName {
+                       get {
+                               return ViewState.GetString ("CommandName", ""); 
+                       }
+               
+                       set {
+                               ViewState ["CommandName"] = value;
+                       }
+               
+               }
+
+#if NET_2_0
+               [DefaultValue ("")]
+               [Themeable (false)]
+               [MonoTODO]
+               public virtual string OnClientClick
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+#endif         
+
+               [Bindable(true)]
+               [DefaultValue("")]
+               [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
+#if NET_2_0
+               [Localizable (true)]
+#endif
+               public virtual string Text {
+                       get {
+                               return ViewState.GetString ("Text", "");        
+                       }
+                       set {
+                               ViewState ["Text"] = value;     
+                               if (HasControls ())
+                                       Controls.Clear ();
+                       }
+               }
+
+               protected virtual void OnClick (EventArgs e)
+               {
+                       EventHandler h = (EventHandler) Events [ClickEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+               static readonly object ClickEvent = new object ();
+               public event EventHandler Click {
+                       add { Events.AddHandler (ClickEvent, value); }
+                       remove { Events.RemoveHandler (ClickEvent, value); }
+               }
+
+               protected virtual void OnCommand (CommandEventArgs e)
+               {
+                       CommandEventHandler h = (CommandEventHandler) Events [CommandEvent];
+                       if (h != null)
+                               h (this, e);
+
+                       RaiseBubbleEvent (this, e);
+               }
+               static readonly object CommandEvent = new object ();
+               public event CommandEventHandler Command {
+                       add { Events.AddHandler (CommandEvent, value); }
+                       remove { Events.RemoveHandler (CommandEvent, value); }
+               }
+#if NET_2_0
+               [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+               [Themeable (false)]
+               [UrlProperty ("*.aspx")]
+               [DefaultValue ("")]
+               [MonoTODO]
+               public string PostBackUrl {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [DefaultValue ("")]
+               [Themeable (false)]
+               public string ValidationGroup {
+                       get {
+                               return ViewState.GetString ("ValidationGroup", "");     
+                       }
+                       set {
+                               ViewState ["ValidationGroup"] = value;  
+                       }
+               }       
+#endif
+       }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
new file mode 100644 (file)
index 0000000..5c08ef2
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.LinkButtonControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class LinkButtonControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
new file mode 100644 (file)
index 0000000..b76a354
--- /dev/null
@@ -0,0 +1,228 @@
+//
+// System.Web.UI.WebControls.ListItem.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls {
+       [ControlBuilder(typeof(ListItemControlBuilder))]
+       [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+       public sealed class ListItem : IAttributeAccessor, IParserAccessor, IStateManager {
+       
+               public ListItem (string text, string value)
+               {
+                       Text = text;
+                       Value = value;
+               }
+       
+               public ListItem (string text) : this (text, null)
+               {
+               }
+       
+               public ListItem () : this (null, null) 
+               {
+               }
+       
+               public static ListItem FromString (string text)
+               {
+                       return new ListItem (text);
+               }
+       
+               public override bool Equals (object o)
+               {
+                       ListItem li = o as ListItem;
+                       if (li == null)
+                               return false;
+                       return li.Text == Text && li.Value == Value;
+               }
+       
+               public override int GetHashCode ()
+               {
+                       return Text.GetHashCode () ^ Value.GetHashCode ();
+               
+               }
+       
+               string IAttributeAccessor.GetAttribute (string key)
+               {
+                       if (attrs == null)
+                               return null;
+
+                       return (string) Attributes [key];
+               }
+       
+               void IAttributeAccessor.SetAttribute (string key, string value)
+               {
+                       Attributes [key] = value;
+               }
+       
+               void IParserAccessor.AddParsedSubObject (object obj)
+               {
+                       LiteralControl lc = obj as LiteralControl;
+                       if (lc != null)
+                               Text = lc.Text;
+               }
+       
+               void IStateManager.LoadViewState (object state)
+               {
+                       LoadViewState (state);
+               }
+               
+               internal void LoadViewState (object state)
+               {
+                       Triplet t = (Triplet) state;
+                       if (!(t.First is bool))
+                               text = (string) t.First;
+                       if (!(t.Second is bool))
+                               value = (string) t.Second;
+                       sb = (StateBag) t.Third;
+               }
+       
+
+               object IStateManager.SaveViewState () 
+               {
+                       return SaveViewState ();
+               }
+
+               internal object SaveViewState ()
+               {
+                       Triplet t = new Triplet ();
+                       t.First = text_dirty ? (object) text : (object) false;
+                       t.Second = value_dirty ? (object) value : (object) false;
+                       t.Third = sb;
+                       return t;
+               }
+               
+               void IStateManager.TrackViewState ()
+               {
+                       TrackViewState ();
+               }
+               
+               internal void TrackViewState ()
+               {
+                       tracking = true;
+               }
+       
+
+               public override string ToString ()
+               {
+                       return Text;
+               }
+       
+       
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public AttributeCollection Attributes {
+                       get {
+                               if (attrs != null)
+                                       return attrs;
+
+                               if (sb == null) {       
+                                       sb = new StateBag (true);
+                                       if (tracking)
+                                               sb.TrackViewState ();
+                               }
+
+                               return attrs = new AttributeCollection (sb);
+                       }
+               }
+
+               bool IStateManager.IsTrackingViewState {
+                       get {
+                               return tracking;
+                       }
+               
+               }
+
+               [DefaultValue(false)]
+               public bool Selected {
+                       get {
+                               return selected;
+                       }
+               
+                       set {
+                               selected = value;
+                       }
+               }
+
+               [DefaultValue("")]
+               [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
+               public string Text {
+                       get {
+                               string r = text;
+                               if (r == null)
+                                       r = value;
+                               if (r == null)
+                                       r = "";
+                               return r;
+                       }
+               
+                       set {
+                               text = value;
+                               text_dirty |= tracking;
+                       }
+               }
+
+               [DefaultValue("")]
+               public string Value {
+                       get {
+                               string r = value;
+                               if (r == null)
+                                       r = text;
+                               if (r == null)
+                                       r = "";
+                               return r;
+                       }
+               
+                       set {
+                               this.value = value;
+                               value_dirty |= tracking;
+                       }
+               }
+
+               
+               internal bool Dirty {
+                       get {
+                               return value_dirty || text_dirty;
+                       }
+                       
+                       set {
+                               value_dirty = text_dirty = value;
+                       }
+               }
+
+               string text;
+               string value;
+               bool selected;
+               bool tracking;
+               bool text_dirty;
+               bool value_dirty;
+               StateBag sb;
+               AttributeCollection attrs;
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
new file mode 100644 (file)
index 0000000..9dec9ad
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.ListItemControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class ListItemControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+
+               public override bool HtmlDecodeLiterals ()
+               {
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
new file mode 100644 (file)
index 0000000..5908654
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.LiteralControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class LiteralControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+
+               public override void AppendSubBuilder (ControlBuilder subBuilder)
+               {
+                       throw new HttpException ("LiteralControlBuilder should never be called");
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
new file mode 100644 (file)
index 0000000..7b045b1
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// System.Web.UI.WebControls.Panel.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+// What to do in AddParsedSubObject
+//
+// 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 {
+       [Designer ("System.Web.UI.Design.WebControls.PanelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       [ParseChildren (false)]
+       [PersistChildren (true)]
+       [ToolboxData ("<{0}:Panel runat=server>Panel</{0}:Panel>")]
+       public class Panel : WebControl {
+
+               public Panel () : base (HtmlTextWriterTag.Div) 
+               {
+               }
+               
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       base.AddAttributesToRender (w);
+                       
+                       if (BackImageUrl != "")
+                               w.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, BackImageUrl);
+
+                       if (!Wrap) {
+#if NET_2_0
+                               w.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");
+#else
+                               w.AddAttribute (HtmlTextWriterAttribute.Nowrap, "nowrap");
+#endif
+                       }
+
+                       string align = "";
+
+                       switch (HorizontalAlign) {
+                       case HorizontalAlign.Center: align = "center"; break;
+                       case HorizontalAlign.Justify: align = "justify"; break;
+                       case HorizontalAlign.Left: align = "left"; break;
+                       case HorizontalAlign.Right: align = "right"; break;
+                       }
+
+                       if (align != "")
+                               w.AddAttribute (HtmlTextWriterAttribute.Align, align);
+               }
+               
+               [Bindable(true)]
+               [DefaultValue("")]
+               [Editor("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+               public virtual string BackImageUrl {
+                       get {
+                               return ViewState.GetString ("BackImageUrl", "");
+                       }
+                       
+                       set {
+                               ViewState ["BackImageUrl"] = value;
+                       }
+               }
+               
+               [Bindable(true)]
+               [DefaultValue(HorizontalAlign.NotSet)]
+               public virtual HorizontalAlign HorizontalAlign {
+                       get {
+                               return (HorizontalAlign) ViewState.GetInt ("HorizontalAlign", (int) HorizontalAlign.NotSet);
+                       }
+                       set {
+                               ViewState ["HorizontalAlign"] = (int) value;
+                       }
+               }
+               
+               [Bindable(true)]
+               [DefaultValue(true)]
+               public virtual bool Wrap {
+                       get {
+                               return ViewState.GetBool ("Wrap", true);
+                       }
+                       set {
+                               ViewState ["Wrap"] = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
new file mode 100644 (file)
index 0000000..8d6441d
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.PlaceHolder.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+// What to do in AddParsedSubObject
+//
+// 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 {
+       [ControlBuilder (typeof (PlaceHolderControlBuilder))]
+       public class PlaceHolder : Control {
+               // Nada?
+       }
+       
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
new file mode 100644 (file)
index 0000000..ce4aded
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.PlaceHolderControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class PlaceHolderControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
new file mode 100644 (file)
index 0000000..92d885d
--- /dev/null
@@ -0,0 +1,443 @@
+//
+// System.Web.UI.WebControls.RepeatInfo.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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.
+//
+
+//#define DEBUG_REPEAT_INFO
+
+using System.Diagnostics;
+
+namespace System.Web.UI.WebControls {
+
+       public sealed class RepeatInfo {
+
+               // What is baseControl for ?
+               public void RenderRepeater (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+               {
+                       PrintValues (user);
+
+                       if (RepeatDirection == RepeatDirection.Vertical)
+                               RenderVert (w, user, controlStyle, baseControl);
+                       else
+                               RenderHoriz (w, user, controlStyle, baseControl);
+               }
+
+               void RenderBr (HtmlTextWriter w)
+               {
+#if NET_2_0
+                       w.Write ("<br />");
+#else
+                       // grrr, not xhtml...
+                       w.Write ("<br>");
+#endif
+
+               }
+
+               void RenderVert (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) 
+               {
+                       int itms = user.RepeatedItemCount;
+                       // total number of rows/columns in our table
+                       int cols = RepeatColumns == 0 ? 1 : RepeatColumns;
+                       // this gets ceil (itms / cols)
+                       int rows = (itms + cols - 1) / cols;
+                       bool sep = user.HasSeparators;
+                       bool oti = OuterTableImplied;
+                       int hdr_span = cols * ((sep && cols != 1) ? 2 : 1);
+
+                       bool table = RepeatLayout == RepeatLayout.Table && !oti;
+
+#if NET_2_0
+                       bool show_empty_trailing_items = true;
+                       bool show_empty_trailing_sep = true;
+#else
+                       bool show_empty_trailing_items = false;
+                       bool show_empty_trailing_sep = false;
+#endif
+                       
+                       if (! oti)
+                               RenderBeginTag (w, controlStyle, baseControl);
+
+                       // Render the header
+                       if (user.HasHeader) {
+                               if (oti)
+                                       user.RenderItem (ListItemType.Header, -1, this, w);
+                               else if (table) {
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                                       // Make sure the header takes up the full width. We have two
+                                       // columns per item if we are using separators, otherwise
+                                       // one per item.
+                                       if (hdr_span != 1)
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+                                       Style s = user.GetItemStyle (ListItemType.Header, -1);
+                                       if (s != null)
+                                               s.AddAttributesToRender (w);
+                                       
+                                       w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       user.RenderItem (ListItemType.Header, -1, this, w);
+                                       w.RenderEndTag (); // td
+                                       w.RenderEndTag (); // tr
+                               } else {
+                                       user.RenderItem (ListItemType.Header, -1, this, w);
+                                       RenderBr (w);
+                               }
+                       }
+
+                       for (int r = 0; r < rows; r ++) {
+                               if (table)
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                               
+                               for (int c = 0; c < cols; c ++) {
+                                       // Find the item number we are in according to the repeat
+                                       // direction.
+                                       int item = index_vert (rows, cols, r, c, itms);
+
+                                       // This item is blank because there there not enough items
+                                       // to make a full row.
+                                       if (!show_empty_trailing_items && item >= itms)
+                                               continue;
+
+                                       if (table) {
+                                               Style s = null;
+                                               if (item < itms)
+                                                       s = user.GetItemStyle (ListItemType.Item, item);
+                                               if (s != null)
+                                                       s.AddAttributesToRender (w);
+                                               w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       }
+                                       
+                                       if (item < itms)
+                                               user.RenderItem (ListItemType.Item, item, this, w);
+
+                                       if (table)
+                                               w.RenderEndTag (); // td
+
+                                       if (sep && cols != 1) {
+                                               if (table) {
+                                                       if (item < itms - 1) {
+                                                               Style s = user.GetItemStyle (ListItemType.Separator, item);
+                                                               if (s != null)
+                                                                       s.AddAttributesToRender (w);
+                                                       }
+                                                       if (item < itms - 1 || show_empty_trailing_sep)
+                                                               w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                               }
+
+                                               if (item < itms - 1)
+                                                       user.RenderItem (ListItemType.Separator, item, this, w);
+
+                                               if (table && (item < itms - 1 || show_empty_trailing_sep))
+                                                       w.RenderEndTag (); // td
+                                       }
+                               }
+                               if (oti) {
+                               } else if (table) {
+                                       w.RenderEndTag (); // tr
+                               } else if (r != rows - 1) {
+                                       RenderBr(w);
+                               }
+                               
+                               if (sep && r != rows - 1 /* no sep on last item */ && cols == 1) {
+                                       if (table) {
+                                               w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                                               Style s = user.GetItemStyle (ListItemType.Separator, r);
+                                               if (s != null)
+                                                       s.AddAttributesToRender (w);
+                                       
+                                               w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       } else if (oti) {
+#if !NET_2_0
+                                               /* 2.0 doesn't render this <br /> */
+                                               RenderBr (w);
+#endif
+                                       }
+                                       
+                                       user.RenderItem (ListItemType.Separator, r, this, w);
+
+                                       if (table) {
+                                               w.RenderEndTag (); // td
+                                               w.RenderEndTag (); // tr
+                                       } else if (!oti) {
+                                               RenderBr (w);
+                                       }
+                               }
+                       }
+
+                       // Render the footer
+                       if (user.HasFooter) {
+                               if (oti)
+                                       user.RenderItem (ListItemType.Footer, -1, this, w);
+                               else if (table) {
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                                       if (hdr_span != 1)
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+                                       Style s = user.GetItemStyle (ListItemType.Footer, -1);
+                                       if (s != null)
+                                               s.AddAttributesToRender (w);
+                                       
+                                       w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       user.RenderItem (ListItemType.Footer, -1, this, w);
+                                       w.RenderEndTag (); // td
+                                       w.RenderEndTag (); // tr
+                               } else {
+                                       // avoid dups on 0 items
+                                       if (itms != 0)
+                                               RenderBr (w);
+                                       user.RenderItem (ListItemType.Footer, -1, this, w);
+                               }
+                       }
+                       if (! oti)
+                               w.RenderEndTag (); // table/span
+                       
+               }
+               
+               void RenderHoriz (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) 
+               {
+                       int itms = user.RepeatedItemCount;
+                       // total number of rows/columns in our table
+                       int cols = RepeatColumns == 0 ? itms : RepeatColumns;
+                       // this gets ceil (itms / cols)
+                       int rows = cols == 0 ? 0 : (itms + cols - 1) / cols;
+                       bool sep = user.HasSeparators;
+                       //bool oti = OuterTableImplied;
+                       int hdr_span = cols * (sep ? 2 : 1);
+
+                       bool table = RepeatLayout == RepeatLayout.Table;
+
+#if NET_2_0
+                       bool show_empty_trailing_items = true;
+                       bool show_empty_trailing_sep = true;
+#else
+                       bool show_empty_trailing_items = false;
+                       bool show_empty_trailing_sep = false;
+#endif
+
+                       RenderBeginTag (w, controlStyle, baseControl);
+                       
+                       // Render the header
+                       if (user.HasHeader) {
+                               if (table) {
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                                       // Make sure the header takes up the full width. We have two
+                                       // columns per item if we are using separators, otherwise
+                                       // one per item.
+                                       if (hdr_span != 1)
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+                                       Style s = user.GetItemStyle (ListItemType.Header, -1);
+                                       if (s != null)
+                                               s.AddAttributesToRender (w);
+                                       
+                                       w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       user.RenderItem (ListItemType.Header, -1, this, w);
+                                       w.RenderEndTag (); // td
+                                       w.RenderEndTag (); // tr
+                               } else {
+                                       user.RenderItem (ListItemType.Header, -1, this, w);
+                                       if (!table && RepeatColumns != 0 && itms != 0)
+                                               RenderBr (w);
+                               }
+                       }
+                                               
+                       for (int r = 0; r < rows; r ++) {
+                               if (table)
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                               
+                               for (int c = 0; c < cols; c ++) {
+                                       // Find the item number we are in according to the repeat
+                                       // direction.
+                                       int item = r * cols + c;
+
+                                       // This item is blank because there there not enough items
+                                       // to make a full row.
+                                       if (!show_empty_trailing_items && item >= itms)
+                                               continue;
+
+                                       if (table) {
+                                               Style s = null;
+                                               if (item < itms)
+                                                       s = user.GetItemStyle (ListItemType.Item, item);
+
+                                               if (s != null)
+                                                       s.AddAttributesToRender (w);
+                                               w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       }
+
+                                       if (item < itms)
+                                               user.RenderItem (ListItemType.Item, item, this, w);
+
+                                       if (table)
+                                               w.RenderEndTag (); // td
+
+                                       if (sep) {
+                                               if (table) {
+                                                       if (item < itms - 1) {
+                                                               Style s = user.GetItemStyle (ListItemType.Separator, item);
+                                                               if (s != null)
+                                                                       s.AddAttributesToRender (w);
+                                                       }
+                                                       if (item < itms - 1 || show_empty_trailing_sep)
+                                                               w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                               }
+
+                                               if (item < itms - 1)
+                                                       user.RenderItem (ListItemType.Separator, item, this, w);
+
+                                               if (table && (item < itms - 1 || show_empty_trailing_sep))
+                                                       w.RenderEndTag (); // td
+                                       }
+                               }
+
+                               if (table) {
+                                       //      if (!oti)
+                                               w.RenderEndTag (); // tr
+                               } else if (!(r == rows -1 && RepeatColumns == 0))
+                                       RenderBr (w);
+                               
+                       }
+
+                       // Render the footer
+                       if (user.HasFooter) {
+                               if (table) {
+                                       w.RenderBeginTag (HtmlTextWriterTag.Tr);
+                                       if (hdr_span != 1)
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+                                       Style s = user.GetItemStyle (ListItemType.Footer, -1);
+                                       if (s != null)
+                                               s.AddAttributesToRender (w);
+                                       
+                                       w.RenderBeginTag (HtmlTextWriterTag.Td);
+                                       user.RenderItem (ListItemType.Footer, -1, this, w);
+                                       w.RenderEndTag (); // td
+                                       w.RenderEndTag (); // tr
+                               } else {
+                                       user.RenderItem (ListItemType.Footer, -1, this, w);
+                               }
+                       }
+                       if (true)
+                               w.RenderEndTag (); // table/span
+                       
+               }
+
+               int index_vert (int rows, int cols, int r, int c, int items)
+               {
+                       int last = items % cols;
+
+                       if (last == 0)
+                               last = cols;
+                       if (r == rows - 1 && c >= last)
+                               return items;
+                       
+                       
+                       int add;
+                       int v;
+                       if (c > last){
+                               add = last * rows + (c-last) * (rows-1);
+                               v = add + r;
+                       } else
+                               v = rows * c + r;
+                       
+                       return v;
+               }
+
+               void RenderBeginTag (HtmlTextWriter w, Style s, WebControl wc)
+               {
+                       WebControl c;
+                       if (RepeatLayout == RepeatLayout.Table)
+                               c = new Table ();
+                       else
+                               c = new Label ();
+
+                       c.ID = wc.ClientID;
+                       c.CopyBaseAttributes (wc);
+                       c.ApplyStyle (s);
+                       c.RenderBeginTag (w);
+               }
+               
+               
+               bool outer_table_implied;
+               public bool OuterTableImplied {
+                       get {
+                               return outer_table_implied;
+                       }
+                       set {
+                               outer_table_implied = value;
+                       }
+               }
+
+               int repeat_cols;
+               public int RepeatColumns {
+                       get {
+                               return repeat_cols;
+                       }
+                       set {
+                               repeat_cols = value;
+                       }
+               }
+
+               RepeatDirection dir = RepeatDirection.Vertical;
+               public RepeatDirection RepeatDirection {
+                       get {
+                               return dir;
+                       }
+                       set {
+                               if (value != RepeatDirection.Horizontal &&
+                                   value != RepeatDirection.Vertical)
+                                       throw new ArgumentOutOfRangeException ();
+                               
+                               dir = value;
+                       }
+               }
+
+               RepeatLayout layout;
+               public RepeatLayout RepeatLayout {
+                       get {
+                               return layout;
+                       }
+                       set {
+                               if (value != RepeatLayout.Flow &&
+                                   value != RepeatLayout.Table)
+                                       throw new ArgumentOutOfRangeException ();       
+                               layout = value;
+                       }
+               }
+
+               [Conditional ("DEBUG_REPEAT_INFO")]
+               internal void PrintValues (IRepeatInfoUser riu)
+               {
+                       string s = String.Format ("Layout {0}; Direction {1}; Cols {2}; OuterTableImplied {3}\n" +
+                                       "User: itms {4}, hdr {5}; ftr {6}; sep {7}", RepeatLayout, RepeatDirection,
+                                       RepeatColumns, OuterTableImplied, riu.RepeatedItemCount, riu.HasSeparators, riu.HasHeader,
+                                       riu.HasFooter, riu.HasSeparators
+                               );
+                       Console.WriteLine (s);
+                       if (HttpContext.Current != null)
+                               HttpContext.Current.Trace.Write (s);
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
new file mode 100644 (file)
index 0000000..9a5dc6a
--- /dev/null
@@ -0,0 +1,466 @@
+//
+// System.Web.UI.WebControls.Repeater.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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.
+//
+
+// Helpful resources while implementing this class:
+//
+// _Developing Microsoft ASP.NET Server Controls and Components_ (Kothari, Datye)
+//    Chapters 16 and 20 (especially listing 20-3 on page 559)
+//
+// "Building DataBound Templated Custom ASP.NET Server Controls" (Mitchell) on MSDN
+//    Right now, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/databoundtemplatedcontrols.asp
+//    works, but with msdn we all know that urls have a very short lifetime :-)
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls {
+       [DefaultEvent ("ItemCommand")]
+       [DefaultProperty ("DataSource")]
+       [Designer ("System.Web.UI.Design.WebControls.RepeaterDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       [ParseChildren (true)]
+       [PersistChildren (false)]
+       public class Repeater : Control, INamingContainer {
+
+               // See Kothari, listing 20-3
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void CreateChildControls ()
+               {
+                       // We are recreating the children from viewstate
+                       Controls.Clear();
+
+                       // Build the children from the viewstate
+                       if (ViewState ["Items"] != null)
+                               CreateControlHierarchy (false);
+               }
+               
+               // See Kothari, listing 20-3
+               protected override void OnDataBinding (EventArgs e)
+               {
+                       base.OnDataBinding (EventArgs.Empty);
+
+                       Controls.Clear ();
+                       ClearChildViewState ();
+                       TrackViewState ();
+
+                       CreateControlHierarchy (true);
+
+                       ChildControlsCreated = true;
+               }
+
+               void DoItem (int i, ListItemType t, object d, bool databind)
+               {
+                       RepeaterItem itm = CreateItem (i, t);
+
+                       if (t == ListItemType.Item || t == ListItemType.AlternatingItem)
+                               items.Add (itm);
+                       
+                       itm.DataItem = d;
+                       RepeaterItemEventArgs e = new RepeaterItemEventArgs (itm);
+                       InitializeItem (itm);
+                       
+                       //
+                       // It is very important that this be called *before* data
+                       // binding. Otherwise, we won't save our state in the viewstate.
+                       //
+                       Controls.Add (itm);
+                       OnItemCreated (e);
+
+                       if (databind) {
+                               itm.DataBind ();
+                               OnItemDataBound (e);
+                       }
+               }
+               
+               protected virtual void CreateControlHierarchy (bool useDataSource)
+               {
+                       IEnumerable ds;
+                       items = new ArrayList ();
+                       itemscol = null;
+                       
+                       if (useDataSource)
+                               ds = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
+                       else
+                               // Optimize (shouldn't need all this memory ;-)
+                               ds = new object [(int) ViewState ["Items"]];
+
+                       // If there is no datasource, then we don't show anything. the "Items"
+                       // viewstate won't get set, so on postback, we won't get here
+                       if (ds == null)
+                               return;
+
+                       if (HeaderTemplate != null)
+                               DoItem (-1, ListItemType.Header, null, useDataSource);
+
+                       int idx = 0;
+                       foreach (object o in ds) {
+                               if (idx != 0 && SeparatorTemplate != null)
+                                       DoItem (idx - 1, ListItemType.Separator, null, useDataSource);
+
+                               DoItem (idx, idx % 2 == 0 ? ListItemType.Item : ListItemType.AlternatingItem, o, useDataSource);
+                               idx ++;
+                       }
+                       
+                       if (FooterTemplate != null)
+                               DoItem (-1, ListItemType.Footer, null, useDataSource);
+
+                       ViewState ["Items"] = idx;
+               }
+               
+               // Why does this get overriden?
+               public override void DataBind ()
+               {
+                       // In all the examples I've seen online, this does base.OnDataBinding and
+                       // then does all the create child controls stuff. But from stack traces on
+                       // windows, this doesn't seem to be the case here.
+                       OnDataBinding (EventArgs.Empty);
+
+               }
+               
+               protected virtual RepeaterItem CreateItem (int itemIndex, ListItemType itemType)
+               {
+                       return new RepeaterItem (itemIndex, itemType);
+               }
+               
+               protected virtual void InitializeItem (RepeaterItem item)
+               {
+                       ITemplate t = null;
+                       
+                       switch (item.ItemType) {
+                       case ListItemType.Header:
+                               t = HeaderTemplate;
+                               break;
+                       case ListItemType.Footer:
+                               t = FooterTemplate;
+                               break;  
+                       case ListItemType.Item:
+                               t = ItemTemplate;
+                               break;
+                       case ListItemType.AlternatingItem:
+                               t = AlternatingItemTemplate;
+                               if (t == null)
+                                       t = ItemTemplate;
+                               break;
+                       case ListItemType.Separator:
+                               t = SeparatorTemplate;
+                               break;
+                       }
+
+                       if (t != null)
+                               t.InstantiateIn (item);                 
+               }
+               
+
+               protected override bool OnBubbleEvent (object sender, EventArgs e)
+               {
+                       RepeaterCommandEventArgs rcea = e as RepeaterCommandEventArgs;
+                       if (rcea != null) {
+                               OnItemCommand (rcea);
+                               return true;
+                       }
+
+                       return false;
+               }
+
+       
+               public override ControlCollection Controls {
+                       get {
+                               EnsureChildControls ();
+                               return base.Controls;
+                       }
+                       
+               }
+
+               RepeaterItemCollection itemscol;
+               ArrayList items;
+               [Browsable(false)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public virtual RepeaterItemCollection Items {
+                       get {
+                               if (itemscol == null)
+                                       itemscol = new RepeaterItemCollection (items);
+                               return itemscol;
+                       }
+               }
+               
+               [DefaultValue("")]
+               public virtual string DataMember {
+                       get {
+                               return ViewState.GetString ("DataMember", "");
+                       }
+                       set {
+                               ViewState ["DataMember"] = value;
+                       }
+               }
+
+               object datasource;
+               [Bindable(true)]
+               [DefaultValue(null)]
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public virtual object DataSource {
+                       get {
+                               return datasource;
+                       }
+                       
+                       set {
+                               if (value == null || value is IListSource || value is IEnumerable)
+                                       datasource = value;
+                               else
+                                       throw new ArgumentException ();
+                       }
+               }
+
+#if NET_2_0
+               [DefaultValue ("")]
+               [IDReferenceProperty (typeof (DataSourceControl))]
+               [MonoTODO]
+               public virtual string DataSourceID
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [Browsable (true)]
+               [MonoTODO]
+               public virtual new bool EnableTheming
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif         
+
+               ITemplate alt_itm_tmpl;
+               [Browsable(false)]
+               [DefaultValue(null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof (RepeaterItem))]
+               public virtual ITemplate AlternatingItemTemplate {
+                       get {
+                               return alt_itm_tmpl;
+                       }
+                       set {
+                               alt_itm_tmpl = value;
+                       }
+               }               
+               
+               ITemplate footer_tmpl;
+               [Browsable(false)]
+               [DefaultValue(null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof (RepeaterItem))]
+               public virtual ITemplate FooterTemplate {
+                       get {
+                               return footer_tmpl;
+                       }
+                       set {
+                               footer_tmpl = value;
+                       }
+               }
+
+               ITemplate header_tmpl;
+               [Browsable(false)]
+               [DefaultValue(null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof (RepeaterItem))]
+               public virtual ITemplate HeaderTemplate {
+                       get {
+                               return header_tmpl;
+                       }
+                       set {
+                               header_tmpl = value;
+                       }
+               }
+
+               ITemplate item_tmpl;
+               [Browsable(false)]
+               [DefaultValue(null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof (RepeaterItem))]
+               public virtual ITemplate ItemTemplate {
+                       get {
+                               return item_tmpl;
+                       }
+                       set {
+                               item_tmpl = value;
+                       }
+               }
+
+               ITemplate separator_tmpl;
+               [Browsable(false)]
+               [DefaultValue(null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof (RepeaterItem))]
+               public virtual ITemplate SeparatorTemplate {
+                       get {
+                               return separator_tmpl;
+                       }
+                       set {
+                               separator_tmpl = value;
+                       }
+               }
+
+               
+               protected virtual void OnItemCommand (RepeaterCommandEventArgs e)
+               {
+                       RepeaterCommandEventHandler h = (RepeaterCommandEventHandler) Events [ItemCommandEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+
+               static readonly object ItemCommandEvent = new object ();
+               public event RepeaterCommandEventHandler ItemCommand {
+                       add { Events.AddHandler (ItemCommandEvent, value); }
+                       remove { Events.RemoveHandler (ItemCommandEvent, value); }
+               }
+
+               
+               protected virtual void OnItemCreated (RepeaterItemEventArgs e)
+               {
+                       RepeaterItemEventHandler h = (RepeaterItemEventHandler) Events [ItemCreatedEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+
+               static readonly object ItemCreatedEvent = new object ();
+               public event RepeaterItemEventHandler ItemCreated {
+                       add { Events.AddHandler (ItemCreatedEvent, value); }
+                       remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+               }
+               
+               protected virtual void OnItemDataBound (RepeaterItemEventArgs e) 
+               {
+                       RepeaterItemEventHandler h = (RepeaterItemEventHandler) Events [ItemDataBoundEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+               
+               static readonly object ItemDataBoundEvent = new object ();
+               public event RepeaterItemEventHandler ItemDataBound {
+                       add { Events.AddHandler (ItemDataBoundEvent, value); }
+                       remove { Events.RemoveHandler (ItemDataBoundEvent, value); }
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected bool Initialized
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               protected bool IsBoundUsingDataSourceID
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               protected bool RequiresDataBinding
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               protected DataSourceSelectArguments SelectArguments
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected void EnsureDataBound ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual IEnumerable GetData ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual void OnDataPropertyChanged ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected internal override void OnInit (EventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected internal override void OnLoad (EventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected internal override void OnPreRender (EventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
new file mode 100644 (file)
index 0000000..97d3cc1
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.WebControls.RepeaterItem
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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 {
+       [ToolboxItem ("")]
+       public class RepeaterItem : Control, INamingContainer {
+       
+               public RepeaterItem (int itemIndex, ListItemType itemType)
+               {
+                       idx = itemIndex;
+                       type = itemType;
+               }
+
+               // see ... "Building DataBound Templated Custom ASP.NET " on msdn
+               //
+               // This technique is used in the DataGrid, DataList, and Repeater to handle the
+               // Command event of Buttons, LinkButtons, and ImageButtons within the
+               // controls. Since the button's Command event calls RaiseBubbleEvent(), this
+               // percolates the event up to the button's parent.
+               protected override bool OnBubbleEvent (object source, EventArgs e)
+               {
+                       CommandEventArgs ce = e as CommandEventArgs;
+                       if (ce != null) {
+                               base.RaiseBubbleEvent (this, new RepeaterCommandEventArgs (this, source, ce));
+                               return true;
+                       }
+
+                       return false;
+               }
+       
+               public virtual object DataItem {
+                       get {
+                               return data_item;
+                       }
+                       set {
+                               data_item = value;
+                       }
+               }
+       
+               public virtual int ItemIndex {
+                       get {
+                               return idx;
+                       }
+               }
+       
+               public virtual ListItemType ItemType {
+                       get {
+                               return type;
+                       }
+               }
+
+               object data_item;
+               int idx;
+               ListItemType type;
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
new file mode 100644 (file)
index 0000000..c7d6ee7
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.WebControls.RepeaterItemCollection
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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;
+
+namespace System.Web.UI.WebControls {
+       public sealed class RepeaterItemCollection : ICollection {
+
+               ArrayList l;
+               
+               public RepeaterItemCollection (ArrayList items)
+               {
+                       l = items;
+               }
+               
+
+               public void CopyTo (Array array, int index)
+               {
+                       l.CopyTo (array, index);
+               }
+               
+               public IEnumerator GetEnumerator ()
+               {
+                       return l.GetEnumerator ();
+               }
+               
+
+               public int Count {
+                       get {
+                               return l.Count;
+                       }
+               }
+               
+               public bool IsReadOnly {
+                       get {
+                               return false;
+                       }
+               }
+               
+               public bool IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+               
+               public RepeaterItem this [int index] {
+                       get {
+                               return (RepeaterItem) l [index];
+                       }
+               }
+               
+               public object SyncRoot {
+                       get {
+                               return l.SyncRoot;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
new file mode 100644 (file)
index 0000000..84bcd82
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// System.Web.UI.WebControls.RequiredFieldValidator
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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 {
+       [ToolboxData ("<{0}:RequiredFieldValidator runat=server ErrorMessage=\"RequiredFieldValidator\"></{0}:RequiredFieldValidator>")]
+       public class RequiredFieldValidator : BaseValidator {
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (RenderUplevel) {
+                               w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+                               w.AddAttribute ("initialvalue", InitialValue);
+                       }
+
+                       base.AddAttributesToRender (w);
+               }
+               
+               protected override bool EvaluateIsValid ()
+               {
+                       return GetControlValidationValue (ControlToValidate) != InitialValue;
+               }
+               
+
+               [Bindable(true)]
+               [DefaultValue("")]
+               public string InitialValue {
+                       get {
+                               return ViewState.GetString ("InitialValue", "");
+                       }
+                       set {
+                               ViewState ["InitialValue"] = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
new file mode 100644 (file)
index 0000000..8e8966e
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// System.Web.UI.WebControls.SelectedDatesCollection
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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;
+
+namespace System.Web.UI.WebControls {
+       public sealed class SelectedDatesCollection : ICollection {
+
+               ArrayList l;
+               
+               public SelectedDatesCollection (ArrayList dateList)
+               {
+                       l = dateList;
+               }
+               
+       
+               public void Add (DateTime date)
+               {
+                       if (Contains (date) == false)
+                               l.Add (date);
+               }
+               
+               public void Clear ()
+               {
+                       l.Clear ();
+               }
+               
+               public bool Contains (DateTime date)
+               {
+                       return l.Contains (date);
+               }
+               
+               public void CopyTo (Array array, int index)
+               {
+                       l.CopyTo (array, index);
+               }
+               
+               public IEnumerator GetEnumerator ()
+               {
+                       return l.GetEnumerator ();
+               }
+               
+               public void Remove (DateTime date)
+               {
+                       l.Remove (date);
+               }
+               
+               public void SelectRange (DateTime fromDate, DateTime toDate)
+               {
+                       l.Clear ();
+                       for (DateTime dt = fromDate; dt <= toDate; dt = dt.AddDays (1))
+                               Add (dt);
+               }
+                       
+               public int Count {
+                       get {
+                               return l.Count;
+                       }
+               }
+               
+               public bool IsReadOnly {
+                       get {
+                               return l.IsReadOnly;
+                       }
+               }
+               
+               public bool IsSynchronized {
+                       get {
+                               return l.IsSynchronized;
+                       }
+               }
+               
+               public DateTime this [int index] {
+                       get {
+                               return (DateTime) l [index];
+                       }
+               }
+               
+               public object SyncRoot {
+                       get {
+                               return this;
+                       }
+               }
+
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
new file mode 100644 (file)
index 0000000..b09433b
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.TableCellControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class TableCellControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
new file mode 100644 (file)
index 0000000..d448bf6
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// System.Web.UI.WebControls.TemplateColumn
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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.Web.UI;
+
+namespace System.Web.UI.WebControls {
+       public class TemplateColumn : DataGridColumn {
+               public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType)
+               {
+                       base.InitializeCell (cell, columnIndex, itemType);
+                       ITemplate t = null;
+                       switch (itemType) {
+                       case ListItemType.Header:
+                               t = HeaderTemplate;
+                               break;
+                       case ListItemType.Footer:
+                               t = FooterTemplate;
+                               break;
+                       case ListItemType.Item:
+                       case ListItemType.AlternatingItem:
+                               t = ItemTemplate;
+                               break;
+                       case ListItemType.EditItem:
+                               t = EditItemTemplate;
+                               if (t == null)
+                                       t = ItemTemplate;
+                               break;
+                       }
+                       
+                       if (t != null)
+                               t.InstantiateIn (cell);
+               }
+
+               ITemplate editItemTemplate, footerTemplate, headerTemplate, itemTemplate;
+               
+               [Browsable(false)]
+               [DefaultValue (null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof(DataGridItem))]
+               public virtual ITemplate EditItemTemplate {
+                       get { return editItemTemplate; }
+                       set { editItemTemplate = value; }
+               }
+               
+               [Browsable(false)]
+               [DefaultValue (null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof(DataGridItem))]
+               public virtual ITemplate FooterTemplate {
+                       get { return footerTemplate; }
+                       set { footerTemplate = value; } 
+               }
+               
+               [Browsable(false)]
+               [DefaultValue (null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof(DataGridItem))]
+               public virtual ITemplate HeaderTemplate {
+                       get { return headerTemplate; }
+                       set { headerTemplate = value; }
+               }
+               
+               [Browsable(false)]
+               [DefaultValue (null)]
+               [PersistenceMode(PersistenceMode.InnerProperty)]
+               [TemplateContainer (typeof(DataGridItem))]
+               public virtual ITemplate ItemTemplate {
+                       get { return itemTemplate; }
+                       set { itemTemplate = value; }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
new file mode 100644 (file)
index 0000000..2d8f195
--- /dev/null
@@ -0,0 +1,351 @@
+//
+// System.Web.UI.WebControls.TextBox.cs
+//
+// Authors:
+//     Ben Maurer (bmaurer@novell.com)
+//
+// (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 {
+       [DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+       [DefaultEvent ("TextChanged")]
+       [DefaultProperty ("Text")]
+       [ValidationProperty ("Text")]
+       [ControlBuilder (typeof (TextBoxControlBuilder))]
+#if NET_2_0
+       [Designer ("System.Web.UI.Design.WebControls.PreviewControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       [ParseChildren (true, "Text")]
+       [ControlValueProperty ("Text", null)]
+#else
+       [ParseChildren (false)]
+#endif         
+       public class TextBox : WebControl, IPostBackDataHandler
+#if NET_2_0
+       , IEditableTextControl, ITextControl
+#endif           
+       {
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (Page != null)
+                               Page.VerifyRenderingInServerForm (this);
+
+                       base.AddAttributesToRender (w);
+                       
+                       switch (TextMode) {
+                       case TextBoxMode.MultiLine:
+                               if (Columns != 0)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString ());
+                               if (Rows != 0)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString ());
+                               if (!Wrap)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off");
+                               
+                               break;
+                               
+                       case TextBoxMode.SingleLine:
+                       case TextBoxMode.Password:
+                               
+                               if (TextMode == TextBoxMode.Password)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "password");
+                               else {
+                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "text");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+                               }
+                               
+                               if (Columns != 0)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString ());
+               
+                               if (MaxLength != 0)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString ());
+                               break;  
+                       }
+
+                       if (AutoPostBack)
+                               w.AddAttribute (HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackClientHyperlink (this, ""));
+                       
+                       if (ReadOnly)
+                               w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly");
+
+                       w.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+               }
+
+               protected override void AddParsedSubObject (object obj)
+               {
+                       LiteralControl l = obj as LiteralControl;
+                       if (l != null)
+                               Text = l.Text;
+               }
+
+               [MonoTODO]
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void OnPreRender (EventArgs e)
+               {
+                       // What do i do here?
+                       base.OnPreRender (e);
+               }
+
+               [MonoTODO ("Am I missing something here")]
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void Render (HtmlTextWriter w)
+               {
+                       // Why didn't msft just override RenderContents!?
+                       RenderBeginTag (w);
+                       if (TextMode == TextBoxMode.MultiLine)
+                               HttpUtility.HtmlEncode (Text, w);
+                       RenderEndTag (w);
+               }
+               
+#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 key, NameValueCollection col)
+               {
+                       if (Text != col [key]) {        
+                               Text = col [key];
+                               return true;
+                       }
+                       
+                       return false;
+               }
+       
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       OnTextChanged (EventArgs.Empty);
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               protected override object SaveViewState ()
+               {
+                       return base.SaveViewState ();
+               }
+#endif         
+       
+#if NET_2_0
+               [DefaultValue (AutoCompleteType.None)]
+               [Themeable (false)]
+               [MonoTODO]
+               public virtual AutoCompleteType AutoCompleteType 
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+#endif         
+               
+               [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)]
+               public virtual bool CausesValidation
+               {
+                       get {
+                               return ViewState.GetBool ("CausesValidation", false);
+                       }
+                       set {
+                               ViewState["CausesValidation"] = value;
+                       }
+               }
+#endif         
+
+#if ONLY_1_1
+               [Bindable(true)]
+#endif         
+               [DefaultValue(0)]
+               public virtual int Columns {
+                       get {
+                               return ViewState.GetInt ("Columns", 0);
+                       }
+                       set {
+                               ViewState ["Columns"] = value;
+                       }
+               }
+
+#if ONLY_1_1
+               [Bindable(true)]
+#endif         
+               [DefaultValue(0)]
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               public virtual int MaxLength {
+                       get {
+                               return ViewState.GetInt ("MaxLength", 0);
+                       }
+                       set {
+                               ViewState ["MaxLength"] = value;
+                       }
+               }
+
+               [Bindable(true)]
+               [DefaultValue(false)]
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               public virtual bool ReadOnly {
+                       get {
+                               return ViewState.GetBool ("ReadOnly", false);
+                       }
+                       set {
+                               ViewState ["ReadOnly"] = value;
+                       }
+               }
+
+#if ONLY_1_1
+               [Bindable(true)]
+#endif         
+               [DefaultValue(0)]
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               public virtual int Rows {
+                       get {
+                               return ViewState.GetInt ("Rows", 0);
+                       }
+                       set {
+                               ViewState ["Rows"] = value;
+                       }
+               }
+       
+#if NET_2_0 && HAVE_CONTROL_ADAPTERS
+               protected virtual new
+#else          
+               protected override
+#endif
+               HtmlTextWriterTag TagKey {
+                       get {
+                               return TextMode == TextBoxMode.MultiLine ? HtmlTextWriterTag.Textarea : HtmlTextWriterTag.Input;
+                       }
+               }
+
+#if NET_2_0
+               [Bindable(true, BindingDirection.TwoWay)]
+#else
+               [Bindable(true)]
+#endif         
+               [DefaultValue("")]
+               [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
+#if NET_2_0
+               [Localizable (true)]
+               [Editor ("System.ComponentModel.Design.MultilineStringEditor," + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+#endif
+               public virtual string Text {
+                       get {
+                               return ViewState.GetString ("Text", "");
+                       }
+                       set {
+                               ViewState ["Text"] = value;
+                               if (TextMode == TextBoxMode.Password)
+                                       ViewState.SetItemDirty ("Text", false);
+                       }
+               }
+       
+               [DefaultValue(TextBoxMode.SingleLine)]
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               public virtual TextBoxMode TextMode {
+                       get {
+                               return (TextBoxMode) ViewState.GetInt ("TextMode", (int) TextBoxMode.SingleLine);
+                       }
+                       set {
+                               ViewState ["TextMode"] = (int) value;
+                       }
+               }
+
+#if NET_2_0
+               [Themeable (false)]
+               [DefaultValue ("")]
+               public string ValidationGroup
+               {
+                       get {
+                               return ViewState.GetString ("ValidationGroup", "");
+                       }
+                       set {
+                               ViewState ["ValidationGroup"] = value;
+                       }
+               }
+#endif         
+       
+               [DefaultValue(true)]
+               public virtual bool Wrap {
+                       get {
+                               return ViewState.GetBool ("Wrap", true);
+                       }
+                       set {
+                               ViewState ["Wrap"] = value;
+                       }
+               }
+
+               protected virtual void OnTextChanged (EventArgs e)
+               {
+                       EventHandler h = (EventHandler) Events [TextChangedEvent];
+                       if (h != null)
+                               h (this, e);
+               }
+               
+               static readonly object TextChangedEvent = new object ();
+               public event EventHandler TextChanged {
+                       add { Events.AddHandler (TextChangedEvent, value); }
+                       remove { Events.RemoveHandler (TextChangedEvent, value); }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
new file mode 100644 (file)
index 0000000..d227298
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.TextBoxControlBuilder
+//
+// Authors:
+//     Ben Maurer <bmaurer@novell.com>
+//
+// (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 {
+       public class TextBoxControlBuilder : ControlBuilder {
+               public override bool AllowWhitespaceLiterals ()
+               {
+                       return false;
+               }
+
+               public override bool HtmlDecodeLiterals ()
+               {
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
new file mode 100644 (file)
index 0000000..73d3745
--- /dev/null
@@ -0,0 +1,1114 @@
+// 
+// System.Web.UI.HtmlTextWriter
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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;
+using System.Globalization;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.UI {
+       
+       public class HtmlTextWriter : TextWriter {
+
+
+               public HtmlTextWriter (TextWriter writer) : this (writer, DefaultTabString)
+               {
+               }
+       
+               public HtmlTextWriter (TextWriter writer, string tabString)
+               {
+                       if (writer == null)
+                               throw new ArgumentNullException ();
+
+                       b = writer;
+                       tab_string = tabString;
+               }
+
+               internal static string StaticGetStyleName (System.Web.UI.HtmlTextWriterStyle styleKey) 
+               {
+                       if ((int) styleKey < htmlstyles.Length)
+                               return htmlstyles [(int) styleKey].name;
+
+                       return null;
+               }
+               
+               [MonoTODO]
+               protected static void RegisterAttribute (string name, HtmlTextWriterAttribute key)
+               {
+               }
+               
+               [MonoTODO]
+               protected static void RegisterStyle (string name, HtmlTextWriterStyle key)
+               {
+               }
+               
+               [MonoTODO]
+               protected static void RegisterTag (string name, HtmlTextWriterTag key)
+               {
+               }
+               
+       
+               public virtual void AddAttribute (HtmlTextWriterAttribute key, string value, bool fEncode)
+               {
+                       if (fEncode)
+                               value = EncodeAttributeValue (key, value);
+                       AddAttribute (GetAttributeName (key), value, key);
+               }
+               
+               
+               public virtual void AddAttribute (HtmlTextWriterAttribute key, string value)
+               {
+                       AddAttribute (key, value, true);
+               }
+       
+       
+               public virtual void AddAttribute (string name, string value, bool fEncode)
+               {
+                       if (fEncode)
+                               value = HttpUtility.HtmlAttributeEncode (value);
+
+                       AddAttribute (name, value, GetAttributeKey (name));
+               }
+               
+               public virtual void AddAttribute (string name, string value)
+               {
+                       AddAttribute (name, value, true);
+               }
+       
+               protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
+               {
+                       NextAttrStack ();
+                       attrs [attrs_pos].name = name;
+                       attrs [attrs_pos].value = value;
+                       attrs [attrs_pos].key = key;
+               }
+               
+               
+               protected virtual void AddStyleAttribute (string name, string value, HtmlTextWriterStyle key)
+               {
+                       NextStyleStack ();
+                       styles [styles_pos].name = name;
+                       styles [styles_pos].value = value;
+                       styles [styles_pos].key = key;
+               }
+               
+
+               public virtual void AddStyleAttribute (string name, string value)
+               {
+                       AddStyleAttribute (name, value, GetStyleKey (name));
+               }
+               
+               public virtual void AddStyleAttribute (HtmlTextWriterStyle key, string value)
+               {
+                       AddStyleAttribute (GetStyleName (key), value, key);
+               }
+       
+               public override void Close ()
+               {
+                       b.Close ();     
+               }
+
+               [MonoTODO]
+               protected virtual string EncodeAttributeValue (HtmlTextWriterAttribute attrKey, string value)
+               {
+                       return value;
+               }
+               
+               [MonoTODO]
+               protected string EncodeAttributeValue (string value, bool fEncode)
+               {
+                       return value;
+               }
+               
+               [MonoTODO]
+               protected string EncodeUrl (string url)
+               {
+                       return url;
+               }
+               
+
+               protected virtual void FilterAttributes ()
+               {
+                       AddedAttr style_attr = new AddedAttr ();
+                       
+                       for (int i = 0; i <= attrs_pos; i ++) {
+                               AddedAttr a = attrs [i];
+                               if (OnAttributeRender (a.name, a.value, a.key)) {
+                                       if (a.key == HtmlTextWriterAttribute.Style) {
+                                               style_attr = a;
+                                               continue;
+                                       }
+                                       
+                                       WriteAttribute (a.name, a.value, false);
+                               }
+                       }
+
+                       if (styles_pos != -1 || style_attr.value != null) {
+                               Write (SpaceChar);
+                               Write ("style");
+                               Write (EqualsDoubleQuoteString);
+                               
+                               
+                               for (int i = 0; i <= styles_pos; i ++) {
+                                       AddedStyle a = styles [i];
+                                       if (OnStyleAttributeRender (a.name, a.value, a.key))
+                                               WriteStyleAttribute (a.name, a.value, false);
+                               }
+
+                               Write (style_attr.value);                               
+                               Write (DoubleQuoteChar);
+                       }
+
+                       styles_pos = attrs_pos = -1;
+               }
+       
+               public override void Flush ()
+               {
+                       b.Flush ();
+               }
+
+               [MonoTODO]
+               protected HtmlTextWriterAttribute GetAttributeKey (string attrName)
+               {
+                       // I don't think we want to binary search
+                       // because there might be something added to
+                       // the enum later. Do we really need anything
+                       // faster than a linear search?
+                       
+                       foreach (HtmlAttribute t in htmlattrs) {
+                               if (t.name == attrName)
+                                       return t.key;
+                       }
+
+                       return 0;               
+               }
+
+               [MonoTODO]
+               protected string GetAttributeName (HtmlTextWriterAttribute attrKey)
+               {
+                       if ((int) attrKey < htmlattrs.Length)
+                               return htmlattrs [(int) attrKey].name;
+
+                       return null;
+               }
+               
+               [MonoTODO]
+               protected HtmlTextWriterStyle GetStyleKey (string styleName)
+               {
+                       // I don't think we want to binary search
+                       // because there might be something added to
+                       // the enum later. Do we really need anything
+                       // faster than a linear search?
+                       
+                       foreach (HtmlStyle t in htmlstyles) {
+                               if (t.name == styleName)
+                                       return t.key;
+                       }
+
+                       return 0;                       
+               }
+               
+               [MonoTODO]
+               protected string GetStyleName (HtmlTextWriterStyle styleKey)
+               {
+                       return StaticGetStyleName (styleKey);
+               }
+               
+               [MonoTODO]
+               protected virtual HtmlTextWriterTag GetTagKey (string tagName) 
+               {
+                       // I don't think we want to binary search
+                       // because there might be something added to
+                       // the enum later. Do we really need anything
+                       // faster than a linear search?
+                       
+                       foreach (HtmlTag t in tags) {
+                               if (t.name == tagName)
+                                       return t.key;
+                       }
+
+                       return HtmlTextWriterTag.Unknown;
+               }
+
+               internal static string StaticGetTagName (HtmlTextWriterTag tagKey)
+               {
+                       if ((int) tagKey < tags.Length)
+                               return tags [(int) tagKey].name;
+
+                       return null;    
+               }
+               
+               
+               [MonoTODO]
+               protected virtual string GetTagName (HtmlTextWriterTag tagKey)
+               {
+                       if ((int) tagKey < tags.Length)
+                               return tags [(int) tagKey].name;
+
+                       return null;
+               }
+               
+               protected bool IsAttributeDefined (HtmlTextWriterAttribute key)
+               {
+                       string value;
+                       return IsAttributeDefined (key, out value);
+               }
+       
+               protected bool IsAttributeDefined (HtmlTextWriterAttribute key, out string value)
+               {
+                       for (int i = 0; i <= attrs_pos; i ++)
+                               if (attrs [i].key == key){
+                                       value = attrs [i].value;
+                                       return true;
+                               }
+
+                       value = null;
+                       return false;
+               }
+               
+               protected bool IsStyleAttributeDefined (HtmlTextWriterStyle key)
+               {
+                       string value;
+                       return IsStyleAttributeDefined (key, out value);
+               }
+       
+               protected bool IsStyleAttributeDefined (HtmlTextWriterStyle key, out string value)
+               {
+                       for (int i = 0; i <= styles_pos; i ++)
+                               if (styles [i].key == key){
+                                       value = styles [i].value;
+                                       return true;
+                               }
+
+                       value = null;
+                       return false;
+               }
+               
+               protected virtual bool OnAttributeRender (string name, string value, HtmlTextWriterAttribute key)
+               {
+                       return true;
+               }
+               
+               protected virtual bool OnStyleAttributeRender (string name, string value, HtmlTextWriterStyle key)
+               {
+                       return true;
+               }
+               
+               protected virtual bool OnTagRender (string name, HtmlTextWriterTag key)
+               {
+                       return true;
+               }
+               
+       
+               protected virtual void OutputTabs ()
+               {
+                       if (! newline)
+                               return;
+                       newline = false;
+                       
+                       for (int i = 0; i < Indent; i ++)
+                               b.Write (tab_string);
+               }
+       
+
+                       
+               protected string PopEndTag ()
+               {
+                       if (tagstack_pos == -1)
+                               throw new InvalidOperationException ();
+                       
+                       string s = TagName;
+                       tagstack_pos --;
+                       return s;
+               }
+               
+               protected void PushEndTag (string endTag)
+               {
+                       NextTagStack ();
+                       TagName = endTag;
+               }
+
+               void PushEndTag (HtmlTextWriterTag t)
+               {
+                       NextTagStack ();
+                       TagKey = t;
+               }
+               
+
+               protected virtual string RenderAfterContent ()
+               {
+                       return null;
+               }
+               
+               protected virtual string RenderAfterTag ()
+               {
+                       return null;
+               }
+               
+               protected virtual string RenderBeforeContent ()
+               {
+                       return null;
+               }
+                       
+               protected virtual string RenderBeforeTag ()
+               {
+                       return null;
+               }
+
+               public virtual void RenderBeginTag (string tagName)
+               {
+                       if (! OnTagRender (tagName, GetTagKey (tagName)))
+                               return;
+
+                       PushEndTag (tagName);
+                       
+                       DoBeginTag ();
+               }
+               
+               public virtual void RenderBeginTag (HtmlTextWriterTag tagKey)
+               {
+                       if (! OnTagRender (GetTagName (tagKey), tagKey))
+                               return;
+
+                       PushEndTag (tagKey);
+
+                       DoBeginTag ();
+               }
+
+               void WriteIfNotNull (string s)
+               {
+                       if (s != null)
+                               Write (s);
+               }
+               
+
+               void DoBeginTag ()
+               {
+                       WriteIfNotNull (RenderBeforeTag ());
+                       WriteBeginTag (TagName);
+                       FilterAttributes ();
+
+                       HtmlTextWriterTag key = (int) TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;
+
+                       switch (tags [(int) key].tag_type) {
+                       case TagType.Inline:
+                               Write (TagRightChar);
+                               break;
+                       case TagType.Block:
+                               Write (TagRightChar);
+                               WriteLine ();
+                               Indent ++;
+                               break;
+                       case TagType.SelfClosing:
+                               Write (SelfClosingTagEnd);
+                               break;
+                       }
+                       
+                       // FIXME what do i do for self close here?
+                       WriteIfNotNull (RenderBeforeContent ());
+               }
+               
+
+               public virtual void RenderEndTag ()
+               {
+                       // FIXME what do i do for self close here?
+                       WriteIfNotNull (RenderAfterContent ());
+                       
+                       HtmlTextWriterTag key = (int) TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;
+
+                       switch (tags [(int) key].tag_type) {
+                       case TagType.Inline:
+                               WriteEndTag (TagName);
+                               break;
+                       case TagType.Block:
+                               Indent --;
+                               WriteLineNoTabs ("");
+                               WriteEndTag (TagName);
+                               
+                               break;
+                       case TagType.SelfClosing:
+                               // NADA
+                               break;
+                       }
+                       WriteIfNotNull (RenderAfterTag ());
+
+                       PopEndTag ();
+               }
+               
+
+               public virtual void WriteAttribute (string name, string value, bool fEncode)
+               {
+                       Write (SpaceChar);
+                       Write (name);
+                       if (value != null) {
+                               Write (EqualsDoubleQuoteString);
+                               value = EncodeAttributeValue (value, fEncode);
+                               Write (value);
+                               Write (DoubleQuoteChar);
+                       }
+               }
+               
+       
+               public virtual void WriteBeginTag (string tagName)
+               {
+                       Write (TagLeftChar);
+                       Write (tagName);
+               }
+               
+               public virtual void WriteEndTag (string tagName)
+               {
+                       Write (EndTagLeftChars);
+                       Write (tagName);
+                       Write (TagRightChar);   
+               }
+               
+               public virtual void WriteFullBeginTag (string tagName)
+               {
+                       Write (TagLeftChar);
+                       Write (tagName);
+                       Write (TagRightChar);
+               }
+                       
+               public virtual void WriteStyleAttribute (string name, string value)
+               {
+                       WriteStyleAttribute (name, value, true);
+               }
+
+               public virtual void WriteStyleAttribute (string name, string value, bool fEncode)
+               {
+#if NET_2_0
+                       if (name == "background-image") {
+                               value = String.Concat ("url(", value, ")");
+                       }
+#endif
+                       Write (name);
+                       Write (StyleEqualsChar);
+                       Write (EncodeAttributeValue (value, fEncode));
+                       Write (SemicolonChar);
+               }
+               
+               public override void Write (char [] buffer, int index, int count)
+               {
+                       OutputTabs ();
+                       b.Write (buffer, index, count);
+               }
+       
+               public override void Write (double value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public override void Write (char value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public override void Write (char [] buffer)
+               {
+                       OutputTabs ();
+                       b.Write (buffer);
+               }
+       
+               public override void Write (int value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public override void Write (string format, object arg0)
+               {
+                       OutputTabs ();
+                       b.Write (format, arg0);
+               }
+       
+               public override void Write (string format, object arg0, object arg1)
+               {
+                       OutputTabs ();
+                       b.Write (format, arg0, arg1);
+               }
+       
+               public override void Write (string format, params object [] args)
+               {
+                       OutputTabs ();
+                       b.Write (format, args);
+               }
+
+               public override void Write (string s)
+               {
+                       OutputTabs ();
+                       b.Write (s);
+               }
+               
+               public override void Write (long value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public override void Write (object value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+               
+               public override void Write (float value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public override void Write (bool value)
+               {
+                       OutputTabs ();
+                       b.Write (value);
+               }
+       
+               public virtual void WriteAttribute (string name, string value)
+               {
+                       WriteAttribute (name, value, true);
+               }
+
+               public override void WriteLine (char value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine (long value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine (object value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true; 
+               }
+       
+               public override void WriteLine (double value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine (char [] buffer, int index, int count)
+               {
+                       OutputTabs ();
+                       b.WriteLine (buffer, index, count);
+                       newline = true;
+               }
+       
+               public override void WriteLine (char [] buffer)
+               {
+                       OutputTabs ();
+                       b.WriteLine (buffer);
+                       newline = true;
+               }
+               
+               public override void WriteLine (bool value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine ()
+               {
+                       OutputTabs ();
+                       b.WriteLine ();
+                       newline = true;
+               }
+       
+               public override void WriteLine (int value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine (string format, object arg0, object arg1)
+               {
+                       OutputTabs ();
+                       b.WriteLine (format, arg0, arg1);
+                       newline = true;
+               }
+       
+               public override void WriteLine (string format, object arg0)
+               {
+                       OutputTabs ();
+                       b.WriteLine (format, arg0);
+                       newline = true;
+               }
+       
+               public override void WriteLine (string format, params object [] args)
+               {
+                       OutputTabs ();
+                       b.WriteLine (format, args);
+                       newline = true;
+               }
+               
+               [CLSCompliant (false)]
+               public override void WriteLine (uint value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public override void WriteLine (string s)
+               {
+                       OutputTabs ();
+                       b.WriteLine (s);
+                       newline = true;
+               }
+       
+               public override void WriteLine (float value)
+               {
+                       OutputTabs ();
+                       b.WriteLine (value);
+                       newline = true;
+               }
+       
+               public void WriteLineNoTabs (string s)
+               {
+                       b.WriteLine (s);
+                       newline = true;
+               }
+
+               public override Encoding Encoding {
+                       get {
+                               return b.Encoding;      
+                       }
+               }
+
+               int indent;
+               public int Indent {
+                       get {
+                               return indent;
+                       }
+                       set {
+                               indent = value;
+                       }
+               }
+       
+               public System.IO.TextWriter InnerWriter {
+                       get {
+                               return b;
+                       }
+                       set {
+                               b = value;
+                       }       
+               }
+       
+               public override string NewLine {
+                       get {
+                               return b.NewLine;
+                       }
+                       set {
+                               b.NewLine = value;
+                       }
+               }
+       
+               protected HtmlTextWriterTag TagKey {
+                       get {
+                               if (tagstack_pos == -1)
+                                       throw new InvalidOperationException ();
+
+                               return tagstack [tagstack_pos].key;
+                       }
+                       set {
+                               tagstack [tagstack_pos].key = value;
+                               tagstack [tagstack_pos].name = GetTagName (value);
+                       }
+               }
+       
+               protected string TagName {
+                       get {
+                               if (tagstack_pos == -1)
+                                       throw new InvalidOperationException ();
+                               
+                               return tagstack [tagstack_pos].name;
+                       }
+                       set {
+                               tagstack [tagstack_pos].name = value;
+                               tagstack [tagstack_pos].key = GetTagKey (value);
+                               if (tagstack [tagstack_pos].key != HtmlTextWriterTag.Unknown)
+                                       tagstack [tagstack_pos].name = GetTagName (tagstack [tagstack_pos].key);
+                       }
+               }
+               
+
+               TextWriter b;
+               string tab_string;
+               bool newline;
+               
+               //
+               // These emulate generic Stack <T>, since we can't use that ;-(. _pos is the current
+               // element.IE, you edit blah [blah_pos]. I *really* want generics, sigh.
+               //
+               AddedStyle [] styles;
+               AddedAttr [] attrs;
+               AddedTag [] tagstack;
+
+               int styles_pos = -1, attrs_pos = -1, tagstack_pos = -1;
+               
+               struct AddedTag {
+                       public string name;
+                       public HtmlTextWriterTag key;
+               }
+               
+               struct AddedStyle {
+                       public string name;
+                       public HtmlTextWriterStyle key;
+                       public string value;
+               }
+               
+               struct AddedAttr {
+                       public string name;
+                       public HtmlTextWriterAttribute key;
+                       public string value;
+               }
+
+               void NextStyleStack ()
+               {
+                       if (styles == null)
+                               styles = new AddedStyle [16];
+                               
+                       if (++styles_pos < styles.Length)
+                               return;
+                       
+                       int nsize = styles.Length * 2;
+                       AddedStyle [] ncontents = new AddedStyle [nsize];
+
+                       Array.Copy (styles, ncontents, styles.Length);
+                       styles = ncontents;
+               }
+
+               void NextAttrStack ()
+               {
+                       if (attrs == null)
+                               attrs = new AddedAttr [16];
+                               
+                       if (++attrs_pos < attrs.Length)
+                               return;
+                       
+                       int nsize = attrs.Length * 2;
+                       AddedAttr [] ncontents = new AddedAttr [nsize];
+
+                       Array.Copy (attrs, ncontents, attrs.Length);
+                       attrs = ncontents;
+               }
+
+               void NextTagStack ()
+               {
+                       if (tagstack == null)
+                               tagstack = new AddedTag [16];
+                               
+                       if (++tagstack_pos < tagstack.Length)
+                               return;
+                                               
+                       int nsize = tagstack.Length * 2;
+                       AddedTag [] ncontents = new AddedTag [nsize];
+
+                       Array.Copy (tagstack, ncontents, tagstack.Length);
+                       tagstack = ncontents;
+               }
+       
+               public const string DefaultTabString = "\t";
+               public const char DoubleQuoteChar = '"';
+               public const string EndTagLeftChars = "</";
+               public const char EqualsChar = '=';
+               public const string EqualsDoubleQuoteString = "=\"";
+               public const string SelfClosingChars = " /";
+               public const string SelfClosingTagEnd = " />";
+               public const char SemicolonChar = ';';
+               public const char SingleQuoteChar = '\'';
+               public const char SlashChar = '/';
+               public const char SpaceChar = ' ' ;
+               public const char StyleEqualsChar = ':';
+               public const char TagLeftChar = '<';
+               public const char TagRightChar = '>';
+
+               enum TagType {
+                       Block,
+                       Inline,
+                       SelfClosing,
+               }
+               
+               
+               struct HtmlTag {
+                       public HtmlTextWriterTag key;
+                       public string name;
+                       public TagType tag_type;
+
+                       public HtmlTag (HtmlTextWriterTag k, string n, TagType tt)
+                       {
+                               key = k;
+                               name = n;
+                               tag_type = tt;
+                       }
+               }
+
+               struct HtmlStyle {
+                       public HtmlTextWriterStyle key;
+                       public string name;
+                       
+                       public HtmlStyle (HtmlTextWriterStyle k, string n)
+                       {
+                               key = k;
+                               name = n;
+                       }
+               }
+
+               
+               struct HtmlAttribute {
+                       public HtmlTextWriterAttribute key;
+                       public string name;
+
+                       public HtmlAttribute (HtmlTextWriterAttribute k, string n)
+                       {
+                               key = k;
+                               name = n;
+                       }
+               }
+               
+               static HtmlTag [] tags = {
+                       new HtmlTag (HtmlTextWriterTag.Unknown,    "",                  TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.A,          "a",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Acronym,    "acronym",           TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Address,    "address",           TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Area,       "area",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.B,          "b",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Base,       "base",              TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Basefont,   "basefont",          TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Bdo,        "bdo",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Bgsound,    "bgsound",           TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Big,        "big",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Blockquote, "blockquote",        TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Body,       "body",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Br,         "br",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Button,     "button",            TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Caption,    "caption",           TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Center,     "center",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Cite,       "cite",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Code,       "code",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Col,        "col",               TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Colgroup,   "colgroup",          TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Dd,         "dd",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Del,        "del",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Dfn,        "dfn",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Dir,        "dir",               TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Div,        "div",               TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Dl,         "dl",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Dt,         "dt",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Em,         "em",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Embed,      "embed",             TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Fieldset,   "fieldset",          TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Font,       "font",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Form,       "form",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Frame,      "frame",             TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Frameset,   "frameset",          TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H1,         "h1",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H2,         "h2",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H3,         "h3",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H4,         "h4",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H5,         "h5",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.H6,         "h6",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Head,       "head",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Hr,         "hr",                TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Html,       "html",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.I,          "i",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Iframe,     "iframe",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Img,        "img",               TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Input,      "input",             TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Ins,        "ins",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Isindex,    "isindex",           TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Kbd,        "kbd",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Label,      "label",             TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Legend,     "legend",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Li,         "li",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Link,       "link",              TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Map,        "map",               TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Marquee,    "marquee",           TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Menu,       "menu",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Meta,       "meta",              TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Nobr,       "nobr",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Noframes,   "noframes",          TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Noscript,   "noscript",          TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Object,     "object",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Ol,         "ol",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Option,     "option",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.P,          "p",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Param,      "param",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Pre,        "pre",               TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Q,          "q",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Rt,         "rt",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Ruby,       "ruby",              TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.S,          "s",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Samp,       "samp",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Script,     "script",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Select,     "select",            TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Small,      "small",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Span,       "span",              TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Strike,     "strike",            TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Strong,     "strong",            TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Style,      "style",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Sub,        "sub",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Sup,        "sup",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Table,      "table",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Tbody,      "tbody",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Td,         "td",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Textarea,   "textarea",          TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Tfoot,      "tfoot",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Th,         "th",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Thead,      "thead",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Title,      "title",             TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Tr,         "tr",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Tt,         "tt",                TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.U,          "u",                 TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Ul,         "ul",                TagType.Block),
+                       new HtmlTag (HtmlTextWriterTag.Var,        "var",               TagType.Inline),
+                       new HtmlTag (HtmlTextWriterTag.Wbr,        "wbr",               TagType.SelfClosing),
+                       new HtmlTag (HtmlTextWriterTag.Xml,        "xml",               TagType.Block),
+               };
+
+               static HtmlAttribute [] htmlattrs = {
+                       new HtmlAttribute (HtmlTextWriterAttribute.Accesskey,         "accesskey"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Align,             "align"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Alt,               "alt"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Background,        "background"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Bgcolor,           "bgcolor"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Border,            "border"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Bordercolor,       "bordercolor"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Cellpadding,       "cellpadding"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Cellspacing,       "cellspacing"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Checked,           "checked"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Class,             "class"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Cols,              "cols"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Colspan,           "colspan"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Disabled,          "disabled"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.For,               "for"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Height,            "height"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Href,              "href"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Id,                "id"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Maxlength,         "maxlength"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Multiple,          "multiple"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Name,              "name"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Nowrap,            "nowrap"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Onchange,          "onchange"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Onclick,           "onclick"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.ReadOnly,          "readonly"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Rows,              "rows"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Rowspan,           "rowspan"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Rules,             "rules"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Selected,          "selected"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Size,              "size"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Src,               "src"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Style,             "style"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Tabindex,          "tabindex"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Target,            "target"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Title,             "title"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Type,              "type"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Valign,            "valign"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Value,             "value"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Width,             "width"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Wrap,              "wrap"),
+#if NET_2_0
+                       new HtmlAttribute (HtmlTextWriterAttribute.Abbr,              "abbr"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.AutoComplete,      "autocomplete"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Axis,              "axis"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Content,           "content"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Coords,            "coords"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.DesignerRegion,    "_designerregion"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Dir,               "dir"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Headers,           "headers"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Longdesc,          "longdesc"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Rel,               "rel"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Scope,             "scope"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Shape,             "shape"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.Usemap,            "usemap"),
+                       new HtmlAttribute (HtmlTextWriterAttribute.VCardName,         "vcard_name"),
+#endif
+               };
+
+               static HtmlStyle [] htmlstyles = {
+                       new HtmlStyle (HtmlTextWriterStyle.BackgroundColor,    "background-color"),
+                       new HtmlStyle (HtmlTextWriterStyle.BackgroundImage,    "background-image"),
+                       new HtmlStyle (HtmlTextWriterStyle.BorderCollapse,     "border-collapse"),
+                       new HtmlStyle (HtmlTextWriterStyle.BorderColor,        "border-color"),
+                       new HtmlStyle (HtmlTextWriterStyle.BorderStyle,        "border-style"),
+                       new HtmlStyle (HtmlTextWriterStyle.BorderWidth,        "border-width"),
+                       new HtmlStyle (HtmlTextWriterStyle.Color,              "color"),
+                       new HtmlStyle (HtmlTextWriterStyle.FontFamily,         "font-family"),
+                       new HtmlStyle (HtmlTextWriterStyle.FontSize,           "font-size"),
+                       new HtmlStyle (HtmlTextWriterStyle.FontStyle,          "font-style"),
+                       new HtmlStyle (HtmlTextWriterStyle.FontWeight,         "font-weight"),
+                       new HtmlStyle (HtmlTextWriterStyle.Height,             "height"),
+                       new HtmlStyle (HtmlTextWriterStyle.TextDecoration,     "text-decoration"),
+                       new HtmlStyle (HtmlTextWriterStyle.Width,              "width"),
+#if NET_2_0
+                       new HtmlStyle (HtmlTextWriterStyle.ListStyleImage,     "list-style-image"),
+                       new HtmlStyle (HtmlTextWriterStyle.ListStyleType,      "list-style-type"),
+                       new HtmlStyle (HtmlTextWriterStyle.Cursor,             "cursor"),
+                       new HtmlStyle (HtmlTextWriterStyle.Direction,          "direction"),
+                       new HtmlStyle (HtmlTextWriterStyle.Display,            "display"),
+                       new HtmlStyle (HtmlTextWriterStyle.Filter,             "filter"),
+                       new HtmlStyle (HtmlTextWriterStyle.FontVariant,        "font-variant"),
+                       new HtmlStyle (HtmlTextWriterStyle.Left,               "left"),
+                       new HtmlStyle (HtmlTextWriterStyle.Margin,             "margin"),
+                       new HtmlStyle (HtmlTextWriterStyle.MarginBottom,       "margin-bottom"),
+                       new HtmlStyle (HtmlTextWriterStyle.MarginLeft,         "margin-left"),
+                       new HtmlStyle (HtmlTextWriterStyle.MarginRight,        "margin-right"),
+                       new HtmlStyle (HtmlTextWriterStyle.MarginTop,          "margin-top"),
+                       new HtmlStyle (HtmlTextWriterStyle.Overflow,           "overflow"),
+                       new HtmlStyle (HtmlTextWriterStyle.OverflowX,          "overflow-x"),
+                       new HtmlStyle (HtmlTextWriterStyle.OverflowY,          "overflow-y"),
+                       new HtmlStyle (HtmlTextWriterStyle.Padding,            "padding"),
+                       new HtmlStyle (HtmlTextWriterStyle.PaddingBottom,      "padding-bottom"),
+                       new HtmlStyle (HtmlTextWriterStyle.PaddingLeft,        "padding-left"),
+                       new HtmlStyle (HtmlTextWriterStyle.PaddingRight,       "padding-right"),
+                       new HtmlStyle (HtmlTextWriterStyle.PaddingTop,         "padding-top"),
+                       new HtmlStyle (HtmlTextWriterStyle.Position,           "position"),
+                       new HtmlStyle (HtmlTextWriterStyle.TextAlign,          "text-align"),
+                       new HtmlStyle (HtmlTextWriterStyle.VerticalAlign,      "vertical-align"),
+                       new HtmlStyle (HtmlTextWriterStyle.TextOverflow,       "text-overflow"),
+                       new HtmlStyle (HtmlTextWriterStyle.Top,                "top"),
+                       new HtmlStyle (HtmlTextWriterStyle.Visibility,         "visibility"),
+                       new HtmlStyle (HtmlTextWriterStyle.WhiteSpace,         "white-space"),
+                       new HtmlStyle (HtmlTextWriterStyle.ZIndex,             "z-index"),
+#endif
+               };
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
new file mode 100644 (file)
index 0000000..1ad707c
--- /dev/null
@@ -0,0 +1,89 @@
+// 
+// System.Web.UI.HtmlTextWriterTag
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       [Serializable]
+       public enum HtmlTextWriterAttribute {
+               Accesskey,
+               Align,
+               Alt,
+               Background,
+               Bgcolor,
+               Border,
+               Bordercolor,
+               Cellpadding,
+               Cellspacing,
+               Checked,
+               Class,
+               Cols,
+               Colspan,
+               Disabled,
+               For,
+               Height,
+               Href,
+               Id,
+               Maxlength,
+               Multiple,
+               Name,
+               Nowrap,
+               Onchange,
+               Onclick,
+               ReadOnly,
+               Rows,
+               Rowspan,
+               Rules,
+               Selected,
+               Size,
+               Src,
+               Style,
+               Tabindex,
+               Target,
+               Title,
+               Type,
+               Valign,
+               Value,
+               Width,
+               Wrap,
+#if NET_2_0
+               Abbr,
+               AutoComplete,
+               Axis,
+               Content,
+               Coords,
+               DesignerRegion,
+               Dir,
+               Headers,
+               Longdesc,
+               Rel,
+               Scope,
+               Shape,
+               Usemap,
+               VCardName
+#endif
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
new file mode 100644 (file)
index 0000000..847b2ac
--- /dev/null
@@ -0,0 +1,79 @@
+// 
+// System.Web.UI.HtmlTextWriterStyle
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       [Serializable]
+       public enum HtmlTextWriterStyle {
+               BackgroundColor,
+               BackgroundImage,
+               BorderCollapse,
+               BorderColor,
+               BorderStyle,
+               BorderWidth,
+               Color,
+               FontFamily,
+               FontSize,
+               FontStyle,
+               FontWeight,
+               Height,
+               TextDecoration,
+               Width,
+#if NET_2_0
+               ListStyleImage,
+               ListStyleType,
+               Cursor,
+               Direction,
+               Display,
+               Filter,
+               FontVariant,
+               Left,
+               Margin,
+               MarginBottom,
+               MarginLeft,
+               MarginRight,
+               MarginTop,
+               Overflow,
+               OverflowX,
+               OverflowY,
+               Padding,
+               PaddingBottom,
+               PaddingLeft,
+               PaddingRight,
+               PaddingTop,
+               Position,
+               TextAlign,
+               VerticalAlign,
+               TextOverflow,
+               Top,
+               Visibility,
+               WhiteSpace,
+               ZIndex
+#endif
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
new file mode 100644 (file)
index 0000000..0e27a63
--- /dev/null
@@ -0,0 +1,130 @@
+// 
+// System.Web.UI.HtmlTextWriterTag
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       [Serializable]
+       public enum HtmlTextWriterTag {
+               Unknown,
+               A,
+               Acronym,
+               Address,
+               Area,
+               B,
+               Base,
+               Basefont,
+               Bdo,
+               Bgsound,
+               Big,
+               Blockquote,
+               Body,
+               Br,
+               Button,
+               Caption,
+               Center,
+               Cite,
+               Code,
+               Col,
+               Colgroup,
+               Dd,
+               Del,
+               Dfn,
+               Dir,
+               Div,
+               Dl,
+               Dt,
+               Em,
+               Embed,
+               Fieldset,
+               Font,
+               Form,
+               Frame,
+               Frameset,
+               H1,
+               H2,
+               H3,
+               H4,
+               H5,
+               H6,
+               Head,
+               Hr,
+               Html,
+               I,
+               Iframe,
+               Img,
+               Input,
+               Ins,
+               Isindex,
+               Kbd,
+               Label,
+               Legend,
+               Li,
+               Link,
+               Map,
+               Marquee,
+               Menu,
+               Meta,
+               Nobr,
+               Noframes,
+               Noscript,
+               Object,
+               Ol,
+               Option,
+               P,
+               Param,
+               Pre,
+               Q,
+               Rt,
+               Ruby,
+               S,
+               Samp,
+               Script,
+               Select,
+               Small,
+               Span,
+               Strike,
+               Strong,
+               Style,
+               Sub,
+               Sup,
+               Table,
+               Tbody,
+               Td,
+               Textarea,
+               Tfoot,
+               Th,
+               Thead,
+               Title,
+               Tr,
+               Tt,
+               U,
+               Ul,
+               Var,
+               Wbr,
+               Xml
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Pair.cs b/mcs/class/System.Web/System.Web.UI/Pair.cs
new file mode 100644 (file)
index 0000000..f1d9af5
--- /dev/null
@@ -0,0 +1,45 @@
+// 
+// System.Web.UI.Pair
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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 {
+       public class Pair {
+       
+               public Pair (object first, object second)
+               {
+                       First = first;
+                       Second = second;
+               }
+
+               public Pair ()
+               {
+               }
+       
+               public object First;
+               public object Second;
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateBag.cs b/mcs/class/System.Web/System.Web.UI/StateBag.cs
new file mode 100644 (file)
index 0000000..401dcf8
--- /dev/null
@@ -0,0 +1,281 @@
+// 
+// System.Web.UI.StateBag
+//
+// Author:
+//        Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// 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;
+using System.Collections.Specialized;
+
+namespace System.Web.UI 
+{
+       
+
+       public sealed class StateBag : IDictionary, IStateManager {
+
+               HybridDictionary ht;
+               bool track;
+               
+               public StateBag (bool ignoreCase)
+               {
+                       ht = new HybridDictionary (ignoreCase);
+               }
+       
+               public StateBag () : this (false)
+               {
+               }
+
+               void IStateManager.LoadViewState (object savedState)
+               {
+                       LoadViewState (savedState);
+               }
+
+               object IStateManager.SaveViewState ()
+               {
+                       return SaveViewState ();
+               }
+               
+               
+               void IStateManager.TrackViewState ()
+               {
+                       TrackViewState ();
+               }
+
+               bool IStateManager.IsTrackingViewState {
+                       get {
+                               return track;
+                       }
+               }
+               
+               internal bool IsTrackingViewState {
+                       get {
+                               return track;
+                       }
+               }       
+
+               
+               internal void LoadViewState (object savedState)
+               {
+                       if (savedState == null)
+                               return;
+                       
+                       foreach (DictionaryEntry de in (Hashtable) savedState)
+                               Add ((string) de.Key, de.Value);
+               }
+               
+               internal object SaveViewState ()
+               {
+                       Hashtable h = null;
+
+                       foreach (DictionaryEntry de in ht) {
+                               StateItem si = (StateItem) de.Value;
+                               if (si.IsDirty) {
+                                       if (h == null)
+                                               h = new Hashtable ();
+                                       h.Add (de.Key, si.Value);
+                               }
+                       }
+
+                       return h;
+               }
+               
+               internal void TrackViewState ()
+               {
+                       track = true;
+               }
+       
+               public StateItem Add (string key, object value)
+               {
+                       StateItem si = ht [key] as StateItem;
+                       if (si == null)
+                               ht [key] = si = new StateItem (value);
+                       si.Value = value;
+                       si.IsDirty |= track;
+                       
+                       return si;
+               }
+
+               internal string GetString (string key, string def)
+               {
+                       string s = (string) this [key];
+                       return s == null ? def : s;
+               }
+               
+               internal bool GetBool (string key, bool def)
+               {
+                       object o = this [key];
+                       return o == null ? def : (bool) o;
+               }
+
+               internal int GetInt (string key, int def)
+               {
+                       object o = this [key];
+                       return o == null ? def : (int) o;
+               }
+
+               internal short GetShort (string key, short def)
+               {
+                       object o = this [key];
+                       return o == null ? def : (short) o;
+               }
+               
+               public void Clear ()
+               {
+                       ht.Clear ();
+               }
+       
+               public IDictionaryEnumerator GetEnumerator ()
+               {
+                       return ht.GetEnumerator ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator ();
+               }
+               
+               public bool IsItemDirty (string key)
+               {
+                       StateItem si = ht [key] as StateItem;
+                       return si != null && si.IsDirty;
+               }
+       
+               public void Remove (string key)
+               {
+                       ht.Remove (key);
+               }
+       
+               public void SetItemDirty (string key, bool dirty) 
+               {
+                       StateItem si = (StateItem) ht [key];
+                       if (si != null)
+                               si.IsDirty = dirty;
+               }
+
+               public int Count {
+                       get {
+                               return ht.Count;
+                       }
+               }
+       
+               public object this [string key] {
+                       get {
+                               StateItem i = ht [key] as StateItem;
+                               if (i != null)
+                                       return i.Value;
+                               return null;
+                       }
+               
+                       set {
+                               if (value == null && ! IsTrackingViewState)
+                                       Remove (key);
+                               else
+                                       Add (key, value);
+                       }
+               }
+       
+               public ICollection Keys {
+                       get {
+                               return ht.Keys;
+                       }
+               
+               }
+       
+               public ICollection Values {
+                       get {
+                               return ht.Values;
+                       }
+               }
+
+               void IDictionary.Add (object key, object value)
+               {
+                       Add ((string) key, value);
+               }
+       
+               void IDictionary.Remove (object key)
+               {
+                       Remove ((string) key);
+               }
+
+               void ICollection.CopyTo (Array array, int index)
+               {
+                       ht.CopyTo (array, index);
+               }
+       
+               bool IDictionary.Contains (object key) 
+               {
+                       return ht.Contains (key);
+               }
+
+               bool ICollection.IsSynchronized {
+                       get {
+                               return false;
+                       }
+               }
+
+               object ICollection.SyncRoot {
+                       get {
+                               return ht;
+                       }       
+               }
+
+               object IDictionary.this [object key] {
+                       get {
+                               return this [(string) key];
+                       }
+               
+                       set {
+                               this [(string) key] = value;
+                       }
+               }
+
+               bool IDictionary.IsFixedSize {
+                       get {
+                               return false;
+                       }
+               }
+       
+               bool IDictionary.IsReadOnly {
+                       get {
+                               return false;
+                       }
+               }
+
+#if NET_2_0
+               public void SetDirty (bool dirty)
+               {
+                       foreach (DictionaryEntry de in ht) {
+                               StateItem si = (StateItem) de.Value;
+                               si.IsDirty = dirty;
+                       }
+               }
+
+               internal void SetDirty ()
+               {
+                       // Just lets me compile
+               }
+#endif
+       }
+}