Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs194
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs143
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs166
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs244
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs304
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs64
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs180
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs178
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs136
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs126
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs142
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs104
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs259
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs230
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs196
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs783
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs342
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs258
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs168
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs275
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs166
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs237
-rw-r--r--mcs/class/System.Web/System.Web.UI/Control.cs6
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs1028
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs112
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs226
27 files changed, 3703 insertions, 2624 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
index bd319d61b54..8d8a4787198 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
@@ -1,95 +1,99 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
-
- private static readonly object EventServerClick;
-
- public HtmlAnchor(): base("a"){}
-
- protected virtual void OnServerClick(EventArgs e){
- EventHandler handler;
- handler = (EventHandler) Events[EventServerClick];
- if(handler != null) handler.Invoke(this, e);
- }
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- if ( (EventHandler) Events[EventServerClick] != null){
- Attributes.Remove("href");
- RenderAttributes(writer);
- writer.WriteAttribute(Page.GetPostBackClientHyperlink(this,""),"href");
- }
- else{
- PreProcessRelativeReference(writer,"href");
- RenderAttributes(writer);
- }
- }
-
- public void RaisePostBackEvent(string eventArgument){
- OnServerClick(EventArgs.Empty);
- }
-
- public event EventHandler ServerClick{
- add{
- Events.AddHandler(EventServerClick, value);
- }
- remove{
- Events.RemoveHandler(EventServerClick, value);
- }
- }
-
- public string HRef{
- get{
- string attr = Attributes["href"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["href"] = AttributeToString(value);
- }
- }
-
- public string Name{
- get{
- string attr = Attributes["name"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["name"] = AttributeToString(value);
- }
- }
-
- public string Target{
- get{
- string attr = Attributes["target"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["target"] = AttributeToString(value);
- }
- }
-
- public string Title{
- get{
- string attr = Attributes["title"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["title"] = AttributeToString(value);
- }
- }
-
- } // class HtmlAnchor
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ static HtmlAnchor(){
+ EventServerClick = new Object();
+ }
+
+ public HtmlAnchor(): base("a"){}
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null) handler.Invoke(this, e);
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ if ( Events[EventServerClick] != null){
+ Attributes.Remove("href");
+ base.RenderAttributes(writer);
+ writer.WriteAttribute("href", Page.GetPostBackClientHyperlink(this,String.Empty));
+ }
+ else{
+ PreProcessRelativeReference(writer,"href");
+ RenderAttributes(writer);
+ }
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public string HRef{
+ get{
+ string attr = Attributes["href"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["href"] = AttributeToString(value);
+ }
+ }
+
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ public string Title{
+ get{
+ string attr = Attributes["title"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["title"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlAnchor
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
index d96d21ca9c0..640daf02fef 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
@@ -1,69 +1,74 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
-
- private static readonly object EventServerClick;
-
- public HtmlButton(): base("button"){}
-
- protected virtual void OnServerClick(EventArgs e){
- EventHandler handler;
- handler = (EventHandler) Events[EventServerClick];
- if(handler != null){
- handler.Invoke(this, e);
- }
- }
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- if (Page != null && Events[EventServerClick] != null){
- System.Web.UI.Util.WriteOnClickAttribute(
- writer,
- this,
- false,
- true,
- CausesValidation == false? Page.Validators.Count > 0: false);
- }
- base.RenderAttributes(writer);
- }
-
- public void RaisePostBackEvent(string eventArgument){
- if (CausesValidation){
- Page.Validate();
- }
- OnServerClick(EventArgs.Empty);
- }
-
- public event EventHandler ServerClick{
- add{
- Events.AddHandler(EventServerClick, value);
- }
- remove{
- Events.RemoveHandler(EventServerClick, value);
- }
- }
-
- public bool CausesValidation{
- get{
- object attr = ViewState["CausesValidation"];
- if (attr != null){
- return (Boolean) attr;
- }
- return true;
- }
- set{
- ViewState["CausesValidation"] = (Boolean) value;
- }
- }
-
- } // class HtmlButton
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ //Checked
+ static HtmlButton(){
+ EventServerClick = new Object();
+ }
+ //Checked
+ public HtmlButton(): base("button"){}
+
+ //Checked
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ if (Page != null && Events[EventServerClick] != null){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object attr = ViewState["CausesValidation"];
+ if (attr != null){
+ return (Boolean) attr;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // class HtmlButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
index e10b8cc2241..41f3b8046c8 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
@@ -1,83 +1,83 @@
-//
-// System.Web.UI.HtmlControls.HtmlContainerControl.cs
-//
-// Author
- // Bob Smith <bob@thestuff.net>
- //
- // (C) Bob Smith
- //
-
- using System;
- using System.Web;
- using System.Web.UI;
-
- //LAMESPEC: The dox talk about HttpException but are very ambigious.
- //TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
- //case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
- //to do anything with children.
- // a doc references this. add? protected override ControlCollection CreateControlCollection();
-
- //TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
- // Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
- //[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
- // System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
- // ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
- // System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
- // System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
- // System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
- // System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
- // System.Web.UI.Page.ProcessRequestMain() +660
-
-
- namespace System.Web.UI.HtmlControls
- {
- public abstract class HtmlContainerControl : HtmlControl{
-
- private string _innerHtml = "";
- private string _innerText = "";
- private bool _doText = false;
- private bool _doChildren = true;
- protected string _tagName;
-
- public HtmlContainerControl() : base(){}
-
- public HtmlContainerControl(string tag) : base(tag) {}
-
- public virtual string InnerHtml
- {
- get
- {
- return _innerHtml;
- }
- set
- {
- _innerHtml = value;
- _doText = false;
- _doChildren = false;
- }
- }
-
- public virtual string InnerText
- {
- get
- {
- return _innerText;
- }
- set
- {
- _innerText = value;
- _doText = true;
- _doChildren = false;
- }
- }
-
- protected override void Render(HtmlTextWriter writer)
- {
- if(_doChildren) RenderChildren(writer);
- else if(_doText) Page.Server.HtmlEncode(_innerText, writer);
- else writer.Write(_innerHtml);
- }
-
- protected virtual void RenderEndTag(HtmlTextWriter writer){}
- }
- }
+//
+// System.Web.UI.HtmlControls.HtmlContainerControl.cs
+//
+// Author
+ // Bob Smith <bob@thestuff.net>
+ //
+ // (C) Bob Smith
+ //
+
+ using System;
+ using System.Web;
+ using System.Web.UI;
+
+ //LAMESPEC: The dox talk about HttpException but are very ambigious.
+ //TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
+ //case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
+ //to do anything with children.
+ // a doc references this. add? protected override ControlCollection CreateControlCollection();
+
+ //TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
+ // Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
+ //[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
+ // System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
+ // ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
+ // System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
+ // System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
+ // System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
+ // System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
+ // System.Web.UI.Page.ProcessRequestMain() +660
+
+
+ namespace System.Web.UI.HtmlControls
+ {
+ public abstract class HtmlContainerControl : HtmlControl{
+
+ private string _innerHtml = String.Empty;
+ private string _innerText = String.Empty;
+ private bool _doText = false;
+ private bool _doChildren = true;
+ protected string _tagName;
+
+ public HtmlContainerControl() : base(){}
+
+ public HtmlContainerControl(string tag) : base(tag) {}
+
+ public virtual string InnerHtml
+ {
+ get
+ {
+ return _innerHtml;
+ }
+ set
+ {
+ _innerHtml = value;
+ _doText = false;
+ _doChildren = false;
+ }
+ }
+
+ public virtual string InnerText
+ {
+ get
+ {
+ return _innerText;
+ }
+ set
+ {
+ _innerText = value;
+ _doText = true;
+ _doChildren = false;
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ if(_doChildren) RenderChildren(writer);
+ else if(_doText) Page.Server.HtmlEncode(_innerText, writer);
+ else writer.Write(_innerHtml);
+ }
+
+ protected virtual void RenderEndTag(HtmlTextWriter writer){}
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
index de8c00f0b18..e188605050b 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
@@ -1,106 +1,138 @@
-//
-// System.Web.UI.HtmlControls.HtmlControl.cs
-//
-// Author
- // Bob Smith <bob@thestuff.net>
- //
- //
- // (C) Bob Smith
- //
-
- using System;
- using System.Globalization;
- using System.Web;
- using System.Web.UI;
-
- namespace System.Web.UI.HtmlControls{
-
- public abstract class HtmlControl : Control, IAttributeAccessor
- {
- private string _tagName = "span";
- //TODO: Is this correct, or is the StateBag really the ViewState?
- private AttributeCollection _attributes = new AttributeCollection(new StateBag(true));
- private bool _disabled = false;
-
- public HtmlControl(){}
-
- public HtmlControl(string tag)
- {
- if(tag != null && tag != "") _tagName = tag;
- }
-
- internal static string AttributeToString(int n){
- if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);
- return null;
- }
-
- internal static string AttributeToString(string s){
- if (s != null && s.Length != 0) return s;
- return null;
- }
-
- internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
- string attr = Attributes[attribName];
- if (attr != null){
- if (attr.Length != 0){
- try{
- attr = ResolveUrl(attr);
- }
- catch (Exception e) {
- throw new HttpException(attribName + " property had malformed url");
- }
- writer.WriteAttribute(attribName, attr);
- Attributes.Remove(attribName);
- }
- }
- }
-
- string System.Web.UI.IAttributeAccessor.GetAttribute(string name){
- return Attributes[name];
- }
-
- void System.Web.UI.IAttributeAccessor.SetAttribute(string name, string value){
- Attributes[name] = value;
- }
-
- protected virtual void RenderAttributes(HtmlTextWriter writer){
- if (ID != null){
- writer.WriteAttribute("id",ClientID);
- }
- Attributes.Render(writer);
- }
-
- public AttributeCollection Attributes
- {
- get
- {
- return _attributes;
- }
- }
- public bool Disabled
- {
- get
- {
- return _disabled;
- }
- set
- {
- _disabled = value;
- }
- }
- public CssStyleCollection Style
- {
- get
- {
- return _attributes.CssStyle;
- }
- }
- public virtual string TagName
- {
- get
- {
- return _tagName;
- }
- }
- }
- }
+//
+// System.Web.UI.HtmlControls.HtmlControl.cs
+//
+// Author
+// Bob Smith <bob@thestuff.net>
+//
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public abstract class HtmlControl : Control, IAttributeAccessor
+ {
+ private string _tagName = "span";
+ //TODO: Is this correct, or is the StateBag really the ViewState?
+ private AttributeCollection _attributes = new AttributeCollection(new StateBag(true));
+ private bool _disabled = false;
+
+ public HtmlControl(){}
+
+ public HtmlControl(string tag)
+ {
+ if(tag != null && tag != String.Empty) _tagName = tag;
+ }
+
+ internal static string AttributeToString(int n){
+ if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);
+ return null;
+ }
+
+ internal static string AttributeToString(string s){
+ if (s != null && s.Length != 0) return s;
+ return null;
+ }
+
+ internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
+ string attr = Attributes[attribName];
+ if (attr != null){
+ if (attr.Length != 0){
+ try{
+ attr = ResolveUrl(attr);
+ }
+ catch (Exception e) {
+ throw new HttpException(attribName + " property had malformed url");
+ }
+ writer.WriteAttribute(attribName, attr);
+ Attributes.Remove(attribName);
+ }
+ }
+ }
+
+ string System.Web.UI.IAttributeAccessor.GetAttribute(string name){
+ return Attributes[name];
+ }
+
+ void System.Web.UI.IAttributeAccessor.SetAttribute(string name, string value){
+ Attributes[name] = value;
+ }
+
+ protected virtual void RenderAttributes(HtmlTextWriter writer){
+ if (ID != null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ Attributes.Render(writer);
+ }
+
+ internal static void WriteOnClickAttribute(HtmlTextWriter writer, bool submitsAutomatically, bool submitsProgramatically, bool causesValidation) {
+ string local1;
+ string local2;
+ string local3;
+
+ AttributeCollection attr = Attributes;
+ local1 = null;
+ if (submitsAutomatically) {
+ if ((causesValidation))
+ local1 = System.Web.UI.Utils.GetClientValidateEvent(Page);
+ }
+ else if (submitsProgramatically) {
+ if (causesValidation)
+ local1 = System.Web.UI.Utils.GetClientValidatedPostback(this);
+ else
+ local1 = Page.GetPostBackClientEvent(this, String.Empty);
+ }
+ if (local1 != null) {
+ local2 = attr["language"];
+ if (local2 != null)
+ attr.Remove("language");
+ writer.WriteAttribute("language", "javascript");
+ local3 = attr["onclick"];
+ if (local3 != null) {
+ attr.Remove("onclick");
+ writer.WriteAttribute("onclick", local3 + " " + local1);
+ return;
+ }
+ writer.WriteAttribute("onclick", local1);
+ }
+ }
+
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ return _attributes;
+ }
+ }
+ public bool Disabled
+ {
+ get
+ {
+ return _disabled;
+ }
+ set
+ {
+ _disabled = value;
+ }
+ }
+ public CssStyleCollection Style
+ {
+ get
+ {
+ return _attributes.CssStyle;
+ }
+ }
+ public virtual string TagName
+ {
+ get
+ {
+ return _tagName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
index ddf8ed4274f..e4c1a817e17 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -1,152 +1,152 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlForm : HtmlContainerControl{
-
- private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
-
- public HtmlForm(): base("form"){}
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name",RenderedName);
- Attributes.Remove("name");
- writer.WriteAttribute("method",Method);
- Attributes.Remove("method");
- writer.WriteAttribute("action",Action,true);
- Attributes.Remove("action");
-
- string clientOnSubmit = Page.ClientOnSubmitEvent;
- if (clientOnSubmit != null && clientOnSubmit.Length > 0){
- if (Attributes["onsubmit"] != null){
- clientOnSubmit = String.Concat(clientOnSubmit,Attributes["onsubmit"]);
- Attributes.Remove("onsubmit");
- }
- writer.WriteAttribute("language","javascript");
- writer.WriteAttribute("onsubmit",clientOnSubmit);
- }
- if (ID == null){
- writer.WriteAttribute("id",ClientID);
- }
- base.RenderAttributes(writer);
- }
-
- //TODO: adapt code for non-IE browsers
- protected override void Render(HtmlTextWriter output){
- if (Page.SmartNavigation == true){
- IAttributeAccessor.SetAttribute("_smartNavigation","true");
- HttpBrowserCapabilities browserCap = Context.Request.Browser;
- if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
- base.Render(output);
- return;
- }
- output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>");
-
- if (browserCap.MinorVersion < 0.5 && browserCap.MajorVersion != 5)
- Page.RegisterClientScriptFileInternal("SmartNavIncludeScript","JScript","SmartNavIE5.js");
- else if (Page.IsPostBack) Page.RegisterClientScriptFileInternal("SmartNavIncludeScript","JScript","SmartNav.js");
- base.Render(output);
- }
- }
-
- protected override void RenderChildren(HtmlTextWriter writer){
- Page.OnFormRender(writer,ClientID);
- base.RenderChildren(writer);
- Page.OnFormPostRender(writer,ClientID);
- }
-
- protected override void OnInit(EventArgs e){
- base.OnInit(e);
- Page.RegisterViewStateHandler();
- }
-
- internal string Action{
- get{
- string executionFilePath = Context.Request.CurrentExecutionFilePath;
- string filePath = Context.Request.FilePath;
- string attr;
- if (String.ReferenceEquals(executionFilePath, filePath) == true){
- attr = filePath;
- int lastSlash = attr.LastIndexOf('/');
- if (lastSlash >= 0)
- attr = attr.Substring(lastSlash + 1);
- }
- else{
- attr = Util.UrlPath.MakeRelative(filePath,executionFilePath);
- }
- string queryString = Context.Request.QueryStringText;
- if (queryString != null && queryString.Length > 0)
- attr = String.Concat(attr, '?', queryString);
- return attr;
- }
- }
-
- public string EncType{
- get{
- string attr = Attributes["enctype"];
- if (attr != null){
- return attr;
- }
- return null;
- }
- set{
- Attributes["enctype"] = AttributeToString(value);
- }
- }
-
- public string Method{
- get{
- string attr = Attributes["method"];
- if (attr != null){
- return attr;
- }
- return "post";
- }
- set{
- Attributes["method"] = AttributeToString(value);
- }
- }
-
- public string Target{
- get{
- string attr = Attributes["target"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["target"] = AttributeToString(value);
- }
- }
-
- public string Name{
- get{
- string attr = Attributes["name"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- }
-
- internal string RenderedName{
- get{
- string attr = Name;
- if (attr.Length > 0){
- return attr;
- }
- return UniqueID;
- }
- }
-
- } // class HtmlForm
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlForm : HtmlContainerControl{
+
+ private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
+
+ public HtmlForm(): base("form"){}
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
+ Attributes.Remove("name");
+ writer.WriteAttribute("method",Method);
+ Attributes.Remove("method");
+ writer.WriteAttribute("action",Action,true);
+ Attributes.Remove("action");
+
+ string clientOnSubmit = Page.ClientOnSubmitEvent;
+ if (clientOnSubmit != null && clientOnSubmit.Length > 0){
+ if (Attributes["onsubmit"] != null){
+ clientOnSubmit = String.Concat(clientOnSubmit,Attributes["onsubmit"]);
+ Attributes.Remove("onsubmit");
+ }
+ writer.WriteAttribute("language","javascript");
+ writer.WriteAttribute("onsubmit",clientOnSubmit);
+ }
+ if (ID == null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ //TODO: adapt code for non-IE browsers
+ protected override void Render(HtmlTextWriter output){
+ if (Page.SmartNavigation == true){
+ IAttributeAccessor.SetAttribute("_smartNavigation","true");
+ HttpBrowserCapabilities browserCap = Context.Request.Browser;
+ if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
+ base.Render(output);
+ return;
+ }
+ output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>");
+
+ if (browserCap.MinorVersion < 0.5 && browserCap.MajorVersion != 5)
+ Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNavIE5.js");
+ else if (Page.IsPostBack) Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNav.js");
+ base.Render(output);
+ }
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ Page.OnFormRender(writer,ClientID);
+ base.RenderChildren(writer);
+ Page.OnFormPostRender(writer,ClientID);
+ }
+
+ protected override void OnInit(EventArgs e){
+ base.OnInit(e);
+ Page.RegisterViewStateHandler();
+ }
+
+ internal string Action{
+ get{
+ string executionFilePath = Context.Request.CurrentExecutionFilePath;
+ string filePath = Context.Request.FilePath;
+ string attr;
+ if (String.ReferenceEquals(executionFilePath, filePath) == true){
+ attr = filePath;
+ int lastSlash = attr.LastIndexOf('/');
+ if (lastSlash >= 0)
+ attr = attr.Substring(lastSlash + 1);
+ }
+ else{
+ attr = Util.UrlPath.MakeRelative(filePath,executionFilePath);
+ }
+ string queryString = Context.Request.QueryStringText;
+ if (queryString != null && queryString.Length > 0)
+ attr = String.Concat(attr, '?', queryString);
+ return attr;
+ }
+ }
+
+ public string EncType{
+ get{
+ string attr = Attributes["enctype"];
+ if (attr != null){
+ return attr;
+ }
+ return null;
+ }
+ set{
+ Attributes["enctype"] = AttributeToString(value);
+ }
+ }
+
+ public string Method{
+ get{
+ string attr = Attributes["method"];
+ if (attr != null){
+ return attr;
+ }
+ return "post";
+ }
+ set{
+ Attributes["method"] = AttributeToString(value);
+ }
+ }
+
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ }
+
+ internal string RenderedName{
+ get{
+ string attr = Name;
+ if (attr.Length > 0){
+ return attr;
+ }
+ return UniqueID;
+ }
+ }
+
+ } // class HtmlForm
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
index c56fe0eceaa..2583de6190b 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
@@ -1,32 +1,32 @@
-//
-// System.Web.UI.HtmlControls.HtmlGenericControl.cs
-//
-// Author:
- // Bob Smith <bob@thestuff.net>
- //
- // (C) Bob Smith
- //
-
- using System;
- using System.Web;
- using System.Web.UI;
-
- namespace System.Web.UI.HtmlControls{
-
- public class HtmlGenericControl : HtmlContainerControl {
-
- public HtmlGenericControl(){}
-
- public HtmlGenericControl(string tag): base(tag){}
-
- public new string TagName {
- get
- {
- return _tagName;
- }
- set{
- _tagName = value;
- }
- }
- }
- }
+//
+// System.Web.UI.HtmlControls.HtmlGenericControl.cs
+//
+// Author:
+ // Bob Smith <bob@thestuff.net>
+ //
+ // (C) Bob Smith
+ //
+
+ using System;
+ using System.Web;
+ using System.Web.UI;
+
+ namespace System.Web.UI.HtmlControls{
+
+ public class HtmlGenericControl : HtmlContainerControl {
+
+ public HtmlGenericControl(){}
+
+ public HtmlGenericControl(string tag): base(tag){}
+
+ public new string TagName {
+ get
+ {
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ }
+ }
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
index fbc67139c55..62135016d4c 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -1,90 +1,90 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlImage : HtmlControl{
-
- public HtmlImage(): base("img"){}
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- PreProcessRelativeReference(writer,"src");
- RenderAttributes(writer);
- writer.Write(" /");
- }
-
- public string Align{
- get{
- string attr = Attributes["align"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["align"] = AttributeToString(value);
- }
- }
-
- public string Alt{
- get{
- string attr = Attributes["alt"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["alt"] = AttributeToString(value);
- }
- }
-
- public int Border{
- get{
- string attr = Attributes["border"];
- if (attr != null){
- return Int32.Parse(attr,CultureInfo.InvariantCulture);
- }
- return -1;
- }
- set{
- Attributes["border"] = AttributeToString(value);
- }
- }
-
- public string Src{
- get{
- string attr = Attributes["src"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["src"] = AttributeToString(value);
- }
- }
-
- public int Width{
- get{
- string attr = Attributes["width"];
- if (attr != null){
- return Int32.Parse(attr,CultureInfo.InvariantCulture);
- }
- return -1;
- }
- set{
- Attributes["width"] = AttributeToString(value);
- }
- }
-
- } // class HtmlImage
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlImage : HtmlControl{
+
+ public HtmlImage(): base("img"){}
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+
+ public int Width{
+ get{
+ string attr = Attributes["width"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
index 416d5cbc895..3f1a75c4133 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
@@ -1,90 +1,88 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
-
- private static readonly object EventServerClick;
-
- public HtmlInputButton(string type): base(type){}
-
- protected void OnServerClick(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerClick];
- if (handler != null){
- handler.Invoke(this, e);
- }
- }
-
- protected override void RenderAttributes(HtmlTextWriter writer){
- string attrType = Type;
- bool ofTypeSubmit = (String.Compare(attrType, "submit", true) == 0);
- bool events;
- if (ofTypeSubmit != true){
- events = (Events[EventServerClick] != null);
- }
- else{
- events = false;
- }
- if (Page != null){
- if (ofTypeSubmit != true){
- System.Web.UI.Util.WriteOnClickAttribute(
- writer,
- this,
- false,
- true,
- CausesValidation == false? Page.Validators.Count > 0: false);
- }
- else{
- if (events != true && String.Compare(attrType,"button", true) != 0){
- System.Web.UI.Util.WriteOnClickAttribute(
- writer,
- this,
- false,
- true,
- CausesValidation == false? Page.Validators.Count > 0: false);
- }
- }
- }
- base.RenderAttributes(writer);
- }
-
- public void RaisePostBackEvent(string eventArgument){
- if(CausesValidation == true){
- Page.Validate();
- }
- OnServerClick(EventArgs.Empty);
- }
-
- public event EventHandler ServerClick{
- add{
- Events.AddHandler(EventServerClick, value);
- }
- remove{
- Events.RemoveHandler(EventServerClick, value);
- }
- }
-
- public bool CausesValidation{
- get{
- object causesVal = ViewState["CausesValidation"];
- if (causesVal != null){
- return (Boolean) causesVal;
- }
- return true;
- }
- set{
- ViewState["CausesValidation"] = (Boolean) value;
- }
- }
-
- } // end of System.Web.UI.HtmlControls.HtmlInputButton
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ public HtmlInputButton(string type): base(type){}
+
+ protected void OnServerClick(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerClick];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ string attrType = Type;
+ bool ofTypeSubmit = (String.Compare(attrType, "submit", true) == 0);
+ bool events;
+ if (ofTypeSubmit != true){
+ events = (Events[EventServerClick] != null);
+ }
+ else{
+ events = false;
+ }
+ if (Page != null){
+ if (ofTypeSubmit != true){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ else{
+ if (events != true && String.Compare(attrType,"button", true) != 0){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ }
+ }
+ base.RenderAttributes(writer);
+ }
+
+ public void RaisePostBackEvent(string eventArgument){
+ if(CausesValidation == true){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null){
+ return (Boolean) causesVal;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlInputButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
index 0c2d397339c..c73915abc15 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
@@ -1,68 +1,68 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler{
-
- private static readonly object EventServerChange;
-
- public HtmlInputCheckBox(): base("checkbox"){}
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postValue = postCollection[postDataKey];
- bool postChecked = false;
- if (postValue != null)
- postChecked = postValue.Length > 0;
- Checked = postChecked;
- return (postChecked == Checked == false);
- }
-
- public void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- protected void OnServerChange(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null) handler.Invoke(this, e);
- }
-
- protected override void OnPreRender(EventArgs e){
- if (Page != null && !Disabled)
- Page.RegisterRequiresPostBack(this);
- if (Events[EventServerChange] != null && !Disabled)
- ViewState.SetItemDirty("checkbox",false);
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- public bool Checked{
- get{
- string attr = Attributes["checked"];
- if (attr != null)
- return attr.Equals("checked");
- return false;
- }
- set{
- Attributes["checked"] = (value == true)? "checked": null;
- }
- }
-
- } // class HtmlInputCheckBox
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputCheckBox(): base("checkbox"){}
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ bool postChecked = false;
+ if (postValue != null)
+ postChecked = postValue.Length > 0;
+ Checked = postChecked;
+ return (postChecked == Checked == false);
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled)
+ Page.RegisterRequiresPostBack(this);
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("checkbox",false);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null)
+ return attr.Equals("checked");
+ return false;
+ }
+ set{
+ Attributes["checked"] = (value == true)? "checked": null;
+ }
+ }
+
+ } // class HtmlInputCheckBox
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
index bf0fafc33aa..5c5010d4451 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
@@ -1,63 +1,63 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputControl : HtmlControl{
-
- public HtmlInputControl(string type):base("type"){
- Attributes["type"] = type;
- }
-
- protected virtual new void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name",RenderedName);
- Attributes.Remove("name");
- base.RenderAttributes(writer);
- writer.Write(" /");
- }
-
- public string Name{
- get{
- return UniqueID;
- }
- set{}
- }
-
- protected virtual string RenderedName{
- get{
- return Name;
- }
- }
-
- public string Type{
- get{
- string attr = Attributes["type"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- }
-
- public virtual string Value{
- get{
- string attr = Attributes["value"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["value"] = AttributeToString(value);
- }
- }
- } // class HtmlInputControl
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputControl : HtmlControl{
+
+ public HtmlInputControl(string type):base("type"){
+ Attributes["type"] = type;
+ }
+
+ protected virtual new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{}
+ }
+
+ protected virtual string RenderedName{
+ get{
+ return Name;
+ }
+ }
+
+ public string Type{
+ get{
+ string attr = Attributes["type"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ }
+
+ public virtual string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputControl
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
index 855a9756fe7..b0e4710db6a 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
@@ -1,71 +1,71 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
-
- public HtmlInputFile():base("file"){}
-
- public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postValue = postCollection[postDataKey];
- if (postValue != null)
- Value = postValue;
- return false;
- }
-
- public virtual void RaisePostDataChangedEvent(){}
-
- public string Accept{
- get{
- string attr = Attributes["accept"];
- if (attr != null)
- return attr;
- return "";
- }
- set{
- Attributes["accept"] = AttributeToString(value);
- }
- }
-
- public int MaxLength{
- get{
- string attr = Attributes["maxlength"];
- if (attr != null)
- return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["accept"] = AttributeToString(value);
- }
- }
-
- public int Size{
- get{
- string attr = Attributes["size"];
- if (attr != null)
- return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["size"] = AttributeToString(value);
- }
- }
-
- public HttpPostedFile PostedFile{
- get{
- return Context.Request.Files[RenderedName];
- }
- }
-
- } // class HtmlInputFile
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
+
+ public HtmlInputFile():base("file"){}
+
+ public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ public virtual void RaisePostDataChangedEvent(){}
+
+ public string Accept{
+ get{
+ string attr = Attributes["accept"];
+ if (attr != null)
+ return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ public int MaxLength{
+ get{
+ string attr = Attributes["maxlength"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public HttpPostedFile PostedFile{
+ get{
+ return Context.Request.Files[RenderedName];
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
index 53fc29fbaf4..daf2a326831 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
@@ -1,52 +1,52 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
-
- private static readonly object EventServerChange;
-
- public HtmlInputHidden(string type):base("hidden"){}
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postValue = postCollection[postDataKey];
- if (postValue != null)
- Value = postValue;
- return false;
- }
-
- public virtual void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- protected void OnServerChange(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null) handler.Invoke(this, e);
- }
-
- protected override void OnPreRender(EventArgs e){
- if (Events[EventServerChange] != null && !Disabled)
- ViewState.SetItemDirty("value",false);
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- } // class HtmlInputFile
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputHidden(string type):base("hidden"){}
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ public virtual void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
index eacbed41cc2..3ac74919160 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
@@ -1,130 +1,129 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputImage : HtmlInputControl, IPostBackEventHandler, IPostBackDataHandler{
-
- private static readonly object EventServerClick;
- private int _x, _y;
-
- public HtmlInputImage(): base("image"){}
-
- protected override void OnPreRender(EventArgs e){
- if (Page != null && !Disabled){
- Page.RegisterRequiresPostBack(this);
- }
- }
-
- protected void OnServerClick(ImageClickEventArgs e){
- ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
- if (handler != null) handler.Invoke(this, e);
- }
-
- protected override void RenderAttributes(HtmlTextWriter writer){
- PreProcessRelativeReference(writer,"src");
- if (Page != null && !CausesValidation){
- System.Web.UI.Util.WriteOnClickAttribute(
- writer,
- this,
- false,
- true,
- CausesValidation == false? Page.Validators.Count > 0: false);
- }
- RenderAttributes(writer);
- }
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postX = postCollection[String.Concat(RenderedName,".x")];
- string postY = postCollection[String.Concat(RenderedName,".y")];
- if (postX != null && postY != null && postX.Length >= 0 && postY.Length >= 0){
- _x = Int32.Parse(postX, CultureInfo.InvariantCulture);
- _y = Int32.Parse(postY, CultureInfo.InvariantCulture);
- Page.RegisterRequiresRaiseEvent(this);
- }
- return false;
- }
-
- public void RaisePostBackEvent(string eventArgument){
- if (CausesValidation){
- Page.Validate();
- }
- OnServerClick(new ImageClickEventArgs(_x,_y));
- }
-
- public void RaisePostDataChangedEvent(){}
-
- public event EventHandler ServerClick{
- add{
- Events.AddHandler(EventServerClick, value);
- }
- remove{
- Events.RemoveHandler(EventServerClick, value);
- }
- }
-
- public string Align{
- get{
- string attr = Attributes["align"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["align"] = AttributeToString(value);
- }
- }
-
- public string Alt{
- get{
- string attr = Attributes["alt"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["alt"] = AttributeToString(value);
- }
- }
-
- public int Border{
- get{
- string attr = Attributes["border"];
- if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["border"] = AttributeToString(value);
- }
- }
-
- public bool CausesValidation{
- get{
- object causesVal = ViewState["CausesValidation"];
- if (causesVal != null) return (Boolean) causesVal;
- return true;
- }
- set{
- ViewState["CausesValidation"] = (Boolean) value;
- }
- }
-
- public string Src{
- get{
- string attr = Attributes["src"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["src"] = AttributeToString(value);
- }
- }
- } // class HtmlInputImage
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputImage : HtmlInputControl, IPostBackEventHandler, IPostBackDataHandler{
+
+ private static readonly object EventServerClick;
+ private int _x, _y;
+
+ public HtmlInputImage(): base("image"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected void OnServerClick(ImageClickEventArgs e){
+ ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ if (Page != null && !CausesValidation){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postX = postCollection[String.Concat(RenderedName,".x")];
+ string postY = postCollection[String.Concat(RenderedName,".y")];
+ if (postX != null && postY != null && postX.Length >= 0 && postY.Length >= 0){
+ _x = Int32.Parse(postX, CultureInfo.InvariantCulture);
+ _y = Int32.Parse(postY, CultureInfo.InvariantCulture);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ public void RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(new ImageClickEventArgs(_x,_y));
+ }
+
+ public void RaisePostDataChangedEvent(){}
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null) return (Boolean) causesVal;
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
index 9ee60f34b7c..62f2de3f506 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
@@ -1,115 +1,115 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler{
-
- private static readonly object EventServerChange;
-
- public HtmlInputRadioButton(): base("radio"){}
-
- protected override void OnPreRender(EventArgs e){
- if (Page != null && !Disabled){
- Page.RegisterRequiresPostBack(this);
- }
- if (Events[EventServerChange] != null && !Disabled){
- ViewState.SetItemDirty("checked", false);
- }
- }
-
- protected void OnServerChange(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null){
- handler.Invoke(this, e);
- }
- }
-
- protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("value", Value);
- Attributes.Remove("value");
- RenderAttributes(writer);
- }
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postValue = postCollection[postDataKey];
- bool myBool = false;
- if (postValue != null && postValue.Equals(Value)){
- if (!Checked){
- Checked = true;
- myBool = true;
- }
- }
- else{
- if (Checked){
- Checked = false;
- myBool = false;
- }
- }
- return myBool;
- }
-
- public void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- public bool Checked{
- get{
- string attr = Attributes["checked"];
- if (attr != null){
- return attr.Equals("checked");
- }
- return false;
- }
- set{
- if (value != true){
- Attributes["checked"] = null;
- }
- Attributes["checked"] = "checked";
- }
- }
- public new string Name{
- get{
- string attr = Attributes["name"];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes["name"] = AttributeToString(value);
- }
- }
-
- private new string RenderedName{
- get{
- string attr = base.RenderedName;
- string id = UniqueID;
- int indexOfX = id.LastIndexOf('X');
- if (indexOfX != 0 && indexOfX >= 0){
- attr = String.Concat(attr, id.Substring(0,indexOfX+1));
- }
- return attr;
- }
- }
-
- } // class HtmlInputRadioButton
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputRadioButton(): base("radio"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("checked", false);
+ }
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("value", Value);
+ Attributes.Remove("value");
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ bool myBool = false;
+ if (postValue != null && postValue.Equals(Value)){
+ if (!Checked){
+ Checked = true;
+ myBool = true;
+ }
+ }
+ else{
+ if (Checked){
+ Checked = false;
+ myBool = false;
+ }
+ }
+ return myBool;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null){
+ return attr.Equals("checked");
+ }
+ return false;
+ }
+ set{
+ if (value != true){
+ Attributes["checked"] = null;
+ }
+ Attributes["checked"] = "checked";
+ }
+ }
+ public new string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ private new string RenderedName{
+ get{
+ string attr = base.RenderedName;
+ string id = UniqueID;
+ int indexOfX = id.LastIndexOf('X');
+ if (indexOfX != 0 && indexOfX >= 0){
+ attr = String.Concat(attr, id.Substring(0,indexOfX+1));
+ }
+ return attr;
+ }
+ }
+
+ } // class HtmlInputRadioButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
index 24a7cfcd4e1..e2ac0471d46 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
@@ -1,98 +1,98 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlInputText : HtmlInputControl, IPostBackDataHandler{
-
- private static readonly object EventServerChange;
-
- public HtmlInputText(string type):base(type){}
- public HtmlInputText():base("text"){}
-
- protected override void OnPreRender(EventArgs e){
- if (Events[EventServerChange] != null && !Disabled){
- ViewState.SetItemDirty("value",false);
- }
- }
-
- protected void OnServerChange(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null) handler.Invoke(this, e);
- }
-
- protected override void RenderAttributes(HtmlTextWriter writer){
- //hide value when password box
- if (String.Compare(Type, "password") != 0){
- ViewState.Remove("value");
- }
- RenderAttributes(writer);
- }
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string currentValue = Value;
- string[] postedValue = postCollection.GetValues(postDataKey);
- if (!currentValue.Equals(postedValue)){
- Value = postedValue[0];
- return true;
- }
- return false;
- }
-
- public void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- public int MaxLength{
- get{
- string attr = (String) ViewState["maxlength"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["maxlength"] = AttributeToString(value);
- }
- }
-
- public int Size{
- get{
- string attr = (String) ViewState["size"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["size"] = AttributeToString(value);
- }
- }
-
- public override string Value{
- get{
- string attr = Attributes["value"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["value"] = AttributeToString(value);
- }
- }
-
- } // class HtmlInputText
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputText : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputText(string type):base(type){}
+ public HtmlInputText():base("text"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ //hide value when password box
+ if (String.Compare(Type, "password") != 0){
+ ViewState.Remove("value");
+ }
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string currentValue = Value;
+ string[] postedValue = postCollection.GetValues(postDataKey);
+ if (!currentValue.Equals(postedValue)){
+ Value = postedValue[0];
+ return true;
+ }
+ return false;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public int MaxLength{
+ get{
+ string attr = (String) ViewState["maxlength"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["maxlength"] = AttributeToString(value);
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = (String) ViewState["size"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public override string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlInputText
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
index ce0584584e4..5b58abda3d0 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -1,381 +1,402 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Globalization;
-using System.ComponentModel;
-using System.Collections;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
-
-
- private int _cachedSelectedIndex = -1;
- private object _dataSource;
- private static readonly object EventServerChange;
- private ListItemCollection _items;
-
- public HtmlSelect():base("select"){}
-
- protected override void AddParsedSubObject(object obj){
- ListItem li = obj as ListItem;
- if (li != null) Items.Add(li);
- else throw new HttpException("HtmlSelect cannot have children of Type " + obj.GetType().Name);
- }
-
- protected virtual void ClearSelection(){
- for (int i =0; i< Items.Count; i++){
- Items[i].Selected = false;
- }
- }
-
- protected override ControlCollection CreateControlCollection(){
- return new EmptyControlCollection(this);
- }
-
- protected override void LoadViewState(object savedState){
- if (savedState != null){
- Triplet state = (Triplet) savedState;
- LoadViewState(state.First);
- Items.LoadViewState(state.Second);
- object thirdState = state.Third;
- if (thirdState != null) Select((int[]) thirdState);
- }
- }
-
- protected override void OnDataBinding(EventArgs e){
- base.OnDataBinding(e);
- IEnumerable resolvedDataSource = DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
- if ( resolvedDataSource != null){
- string text = DataTextField;
- string value = DataValueField;
- Items.Clear();
- ICollection rdsCollection = resolvedDataSource as ICollection;
- if (rdsCollection != null){
- Items.Capacity = rdsCollection.Count;
- }
- bool valid = false;
- if (text.Length >= 0 && value.Length >= 0)
- valid = true;
- foreach (IEnumerable current in resolvedDataSource.GetEnumerator()){
- ListItem li = new ListItem();
- if (valid == true){
- if (text.Length >= 0)
- li.Text = DataBinder.GetPropertyValue(current, text, null);
- if (value.Length >= 0)
- li.Value = DataBinder.GetPropertyValue(current, value, null);
- }
- else{
- li.Value = current.ToString;
- li.Text = current.ToString;
- }
- Items.Add(li);
- }
- }
- if ( _cachedSelectedIndex != -1){
- SelectedIndex = _cachedSelectedIndex;
- _cachedSelectedIndex = -1;
- }
- }
-
- protected override void OnPreRender(EventArgs e){
- if (Page != null && Size >= 0 && !Disabled){
- Page.RegisterRequiresPostBack(this);
- }
- }
-
- protected virtual void OnServerChange(EventArgs e){
- EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null)
- handler.Invoke(this,e);
- }
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name", Name);
- Attributes.Remove("name");
- Attributes.Remove("DataValueField");
- Attributes.Remove("DataTextField");
- Attributes.Remove("DataMember");
- RenderAttributes(writer);
- }
-
- protected override void RenderChildren(HtmlTextWriter writer){
- //flush output
- writer.WriteLine();
- // increase indent level, improves readability
- writer.Indent = writer.Indent + 1;
- if (Items.Count >= 0){
- // display all options, and set the selected option
- foreach (ListItem option in Items){
- //write begin tag with attributes
- writer.WriteBeginTag("option");
- if (option.Selected == true){
- writer.WriteAttribute("selected","selected");
- }
- writer.WriteAttribute("value",option.Value,true);
- option.Attributes.Remove("text");
- option.Attributes.Remove("value");
- option.Attributes.Remove("selected");
- option.Attributes.Render(writer);
- writer.Write('>');
- //write the option text
- HttpUtility.HtmlEncode(option.Text, writer);
- //close the current option tag
- writer.WriteEndTag("option");
- //flush output
- writer.WriteLine();
- }
- }
- // set the indent level back to normal
- writer.Indent = writer.Indent - 1;
- }
-
- protected override object SaveViewState(){
- //TODO: find some better names, out of inspiration
- object itemsViewState = SaveViewState();
- object third = null;
- if (Events[EventServerChange] != null && !Disabled && Visible){
- third = SelectedIndices;
- }
- if (third != null && base.SaveViewState() != null && itemsViewState != null){
- return new Triplet(itemsViewState, base.SaveViewState(), third);
- }
- return null;
- }
-
- protected virtual void Select(int[] selectedIndices){
- // unselect all options
- ClearSelection();
- // iterate through options, and set when selected
- foreach (int current in selectedIndices){
- if (current >= 0 && current < Items.Count){
- Items[current].Selected = true;
- }
- }
- }
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- //get the posted selectedIndices[]
- string[] postedValues = postCollection.GetValues(postDataKey);
- bool valid = false;
- if (postedValues != null){
- //single selection
- if (!Multiple){
- int postedValue = Items.FindByValueInternal(postedValues[0]);
- if (postedValue != 0){
- //set the SelectedIndex
- SelectedIndex = postedValue;
- valid = true;
- }
- }
- //multiple selection
- else{
- int postedValuesCount = postedValues.Length;
- int[] arr= new int[postedValuesCount];
- //fill an array with the posted Values
- for (int i = 0; i <= postedValuesCount; i++)
- arr[i] = Items.FindByValueInternal(postedValues[i]);
- //test if everything went fine
- if( postedValuesCount == SelectedIndices.Length)
- for (int i = 0; i <= postedValuesCount; i++)
- if(arr[i] == SelectedIndices[i])
- valid = true;
- else
- valid = true;
- //commit the posted Values
- if(valid == true)
- Select(arr);
- }
- }
- else{
- if (SelectedIndex != -1){
- SelectedIndex = -1;
- valid = true;
- }
- }
- return valid;
- }
-
- public void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- protected override void TrackViewState(){
- base.TrackViewState();
- Items.TrackViewState();
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- public virtual string DataMember{
- get{
- object viewStateDataMember = ViewState["DataMember"];
- if ( viewStateDataMember != null) return (String) viewStateDataMember;
- return String.Empty;
- }
- set{
- Attributes["DataMember"] = AttributeToString(value);
- }
- }
-
- public virtual object DataSource{
- get{
- return _dataSource;
- }
- set{
- if (value != null && value is IListSource){
- if (value is IEnumerable){
- _dataSource = value;
- }
- else{
- throw new ArgumentException("Invalid dataSource type");
- }
- }
- }
- }
-
- public virtual string DataTextField{
- get{
- string attr = Attributes["DataTextField"];
- if (attr != null){
- return attr;
- }
- return String.Empty;
- }
- set{
- Attributes["DataTextField"] = AttributeToString(value);
- }
- }
-
- public virtual string DataValueField{
- get{
- string attr = Attributes["DataValueField"];
- if (attr != null)return attr;
- return String.Empty;
- }
- set{
- Attributes["DataValueField"] = AttributeToString(value);
- }
- }
-
- public override string InnerHtml{
- get{
- throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
- }
- set{
- throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
- }
- }
-
- public override string InnerText{
- get{
- throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
- }
- set{
- throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
- }
- }
-
- public ListItemCollection Items{
- get{
- if (_items == null){
- _items = new ListItemCollection();
- if (IsTrackingViewState) _items.TrackViewState();
- }
- return _items;
- }
- }
-
- public bool Multiple{
- get{
- string attr = Attributes["multiple"];
- if (attr != null) return attr.Equals("multiple");
- return false;
- }
- set{
- if (value == true) Attributes["multiple"] = "multiple";
- else Attributes["multiple"] = null;
- }
- }
-
- public string Name{
- get{
- return UniqueID;
- }
- set{
- //LAMESPEC
- return;
- }
- }
-
- public virtual int SelectedIndex {
- get{
- for (int i=0; i<=Items.Count; i++){
- if (Items[i].Selected == true) return i;
- }
- if (Size<=1 && Multiple){
- if(Items.Count >= 0) Items[0].Selected = true;
- return 0;
- }
- return -1;
- }
- set{
- //TODO: check funtion
- if(Items.Count != 0) _cachedSelectedIndex = value;
- else if (value <=-1 || Items.Count < value) throw new ArgumentOutOfRangeException();
- ClearSelection();
- if (value >= 0) Items[value].Selected = true;
- }
- }
-
- protected virtual int[] SelectedIndices {
- get{
- //TODO: check function
- return null;
- }
- }
-
- public int Size{
- get{
- string attr = Attributes["size"];
- if (attr != null){
- return Int32.Parse(attr, CultureInfo.InvariantCulture);;
- }
- return -1;
- }
- set{
- Attributes["size"] = AttributeToString(value);
- }
- }
-
- public string Value{
- get{
- int selectedIndex = SelectedIndex;
- if (selectedIndex >=0 && selectedIndex <= Items.Count){
- return Items[selectedIndex].Value;
- }
- return String.Empty;
- }
- set{
- int findValue = Items.FindByValueInternal(value);
- if (findValue >= 0) SelectedIndex = findValue;
- }
- }
-
- } // class HtmlInputText
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
+
+
+ private int _cachedSelectedIndex;
+ private object _dataSource;
+ private static readonly object EventServerChange;
+ private ListItemCollection _items;
+
+ public HtmlSelect():base("select"){
+ _cachedSelectedIndex = -1;
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj as ListItem != null) {
+ this.Items.Add((ListItem) obj);
+ return;
+ }
+ throw new HttpException("HtmlSelect cannot have children of Type " + obj.GetType().Name);
+ }
+
+ protected virtual void ClearSelection(){
+ for (int i =0; i<= Items.Count; i++){
+ Items[i].Selected = false;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection(){
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState){
+ if (savedState != null){
+ Triplet state = (Triplet) savedState;
+ LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ object thirdState = state.Third;
+ if (thirdState != null) Select((int[]) thirdState);
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e){
+ base.OnDataBinding(e);
+ IEnumerable resolvedDataSource = System.Web.Utils.DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+ if ( resolvedDataSource != null){
+ string text = DataTextField;
+ string value = DataValueField;
+ Items.Clear();
+ ICollection rdsCollection = resolvedDataSource as ICollection;
+ if (rdsCollection != null){
+ Items.Capacity = rdsCollection.Count;
+ }
+ bool valid = false;
+ if (text.Length >= 0 && value.Length >= 0)
+ valid = true;
+ ListItem li = new ListItem();
+ IEnumerator current = resolvedDataSource.GetEnumerator();
+ while(current.MoveNext()){
+ if (valid == true){
+ if (text.Length >= 0)
+ li.Text = DataBinder.GetPropertyValue(current, text, null);
+ if (value.Length >= 0)
+ li.Value = DataBinder.GetPropertyValue(current, value, null);
+ }
+ else{
+ li.Value = li.Text = current.ToString();
+ }
+ }
+ Items.Add(li);
+ }
+ if ( _cachedSelectedIndex != -1){
+ SelectedIndex = _cachedSelectedIndex;
+ _cachedSelectedIndex = -1;
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && Size >= 0 && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null)
+ handler.Invoke(this,e);
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ Attributes.Remove("DataValueField");
+ Attributes.Remove("DataTextField");
+ Attributes.Remove("DataMember");
+ RenderAttributes(writer);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ //flush output
+ writer.WriteLine();
+ // increase indent level, improves readability
+ writer.Indent = writer.Indent + 1;
+ if (Items.Count >= 0){
+ // display all options, and set the selected option
+ foreach (ListItem option in Items){
+ //write begin tag with attributes
+ writer.WriteBeginTag("option");
+ if (option.Selected == true){
+ writer.WriteAttribute("selected","selected");
+ }
+ writer.WriteAttribute("value",option.Value,true);
+ option.Attributes.Remove("text");
+ option.Attributes.Remove("value");
+ option.Attributes.Remove("selected");
+ option.Attributes.Render(writer);
+ writer.Write('>');
+ //write the option text
+ HttpUtility.HtmlEncode(option.Text, writer);
+ //close the current option tag
+ writer.WriteEndTag("option");
+ //flush output
+ writer.WriteLine();
+ }
+ }
+ // set the indent level back to normal
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override object SaveViewState(){
+ object itemsViewState = SaveViewState();
+ object third = null;
+ if (Events[EventServerChange] != null && !Disabled && Visible){
+ third = SelectedIndices;
+ }
+ if (third != null && base.SaveViewState() != null && itemsViewState != null){
+ return new Triplet(itemsViewState, base.SaveViewState(), third);
+ }
+ return null;
+ }
+
+ protected virtual void Select(int[] selectedIndices){
+ // unselect all options
+ ClearSelection();
+ // iterate through options, and set when selected
+ foreach (int current in selectedIndices){
+ if (current >= 0 && current < Items.Count){
+ Items[current].Selected = true;
+ }
+ }
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ //get the posted selectedIndices[]
+ string[] postedValueColl = postCollection.GetValues(postDataKey);
+ bool valid = false;
+ if (postedValueColl != null){
+ if (!Multiple){
+ //single selection
+ //int postedValue = Items.FindIndexByValue(postedValueColl[0]);
+ int postedValue = Items.IndexOf(Items.FindByValue(postedValueColl[0]));
+ if (postedValue != SelectedIndex){
+ //set the SelectedIndex
+ SelectedIndex = postedValue;
+ valid = true;
+ }
+ }
+ else{
+ //multiple selection
+ int postedValueCount = postedValueColl.Length;
+ int[] arr= new int[postedValueCount];
+ //fill an array with the posted Values
+ for (int i = 0; i <= postedValueCount; i++)
+ arr[i] = Items.IndexOf(Items.FindByValue(postedValueColl[i]));
+ //test if everything went fine
+ if( postedValueCount == SelectedIndices.Length)
+ for (int i = 0; i <= postedValueCount; i++)
+ if(arr[i] == SelectedIndices[i])
+ valid = true;
+ else
+ valid = true;
+ //commit the posted Values
+ if(valid)
+ Select(arr);
+ }
+ }
+ else if (SelectedIndex != -1){
+ SelectedIndex = -1;
+ valid = true;
+ }
+ return valid;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ //starts tracking changes to the viewstate
+ protected internal virtual void TrackViewState(){
+ TrackViewState();
+ Items.TrackViewState();
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public virtual string DataMember{
+ get{
+ object viewStateDataMember = ViewState["DataMember"];
+ if ( viewStateDataMember != null) return (String) viewStateDataMember;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataMember"] = HtmlControl.AttributeToString(value);
+ }
+ }
+
+ public virtual object DataSource{
+ get{
+ return _dataSource;
+ }
+ set{
+ if (value != null && value is IListSource){
+ if (value is IEnumerable){
+ _dataSource = value;
+ }
+ else{
+ throw new ArgumentException("Invalid dataSource type");
+ }
+ }
+ }
+ }
+
+ public virtual string DataTextField{
+ get{
+ string attr = Attributes["DataTextField"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["DataTextField"] = AttributeToString(value);
+ }
+ }
+
+ public virtual string DataValueField{
+ get{
+ string attr = Attributes["DataValueField"];
+ if (attr != null)return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataValueField"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml{
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public override string InnerText{
+ get{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public ListItemCollection Items{
+ get{
+ if (_items == null){
+ _items = new ListItemCollection();
+ if (IsTrackingViewState) _items.TrackViewState();
+ }
+ return _items;
+ }
+ }
+
+ public bool Multiple{
+ get{
+ string attr = Attributes["multiple"];
+ if (attr != null) return attr.Equals("multiple");
+ return false;
+ }
+ set{
+ if (value == true) Attributes["multiple"] = "multiple";
+ else Attributes["multiple"] = null;
+ }
+ }
+
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{
+ //LAMESPEC
+ return;
+ }
+ }
+
+ public virtual int SelectedIndex {
+ get{
+ for (int i=0; i<=Items.Count; i++){
+ if (Items[i].Selected == true) return i;
+ }
+ if (Size<=1 && !Multiple){
+ if(Items.Count > 0) Items[0].Selected = true;
+ return 0;
+ }
+ return -1;
+ }
+ set{
+ if(Items.Count == 0){
+ _cachedSelectedIndex = value;
+ return;
+ }
+ else if (value < -1 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException();
+ ClearSelection();
+ if (value >= 0)
+ Items[value].Selected = true;
+ }
+ }
+
+ protected virtual int[] SelectedIndices {
+ get{
+ int[] indices = new int[3];
+ int indicesCount = 0;
+ for(int i=0; i <= Items.Count; i++){
+ if(Items[i].Selected){
+ if( indicesCount == (int) indices.Length){
+ int[] temp = new int[indicesCount + indicesCount];
+ indices.CopyTo(temp,0);
+ indices = temp;
+ }
+ indicesCount++;
+ indices[indicesCount] = i;
+ }
+ }
+ int[] arr = new int[indicesCount];
+ System.Array.Copy(indices,0,arr,0,indicesCount);
+ return arr;
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public string Value{
+ get{
+ int selectedIndex = SelectedIndex;
+ if (selectedIndex >=0 && selectedIndex <= Items.Count){
+ return Items[selectedIndex].Value;
+ }
+ return String.Empty;
+ }
+ set{
+ int findValue = Items.IndexOf(Items.FindByValue(value));
+ if (findValue >= 0) SelectedIndex = findValue;
+ }
+ }
+
+ } // class HtmlSelect
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
index 4e3d402bd9c..db057fd16ff 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
@@ -1,171 +1,171 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlTable : HtmlContainerControl {
- private HtmlTableRowCollection _rows;
-
- public HtmlTable():base("table"){}
-
- protected override ControlCollection CreateControlCollection(){
- return new HtmlTableRowControlCollection(this);
- }
-
- protected override void RenderChildren(HtmlTextWriter writer){
- writer.WriteLine();
- writer.Indent = writer.Indent + 1;
- base.RenderChildren(writer);
- writer.Indent = writer.Indent - 1;
- }
-
- protected new void RenderEndTag(HtmlTextWriter writer){
- base.RenderEndTag(writer);
- writer.WriteLine();
- }
-
- public string Align {
- get{
- string attr = Attributes["align"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["align"] = AttributeToString(value);
- }
- }
-
- public string BgColor {
- get{
- string attr = Attributes["bgcolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bgcolor"] = AttributeToString(value);
- }
- }
-
- public int Border {
- get{
- string attr = Attributes["border"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["border"] = AttributeToString(value);
- }
- }
-
- public string BorderColor {
- get{
- string attr = Attributes["bordercolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bordercolor"] = AttributeToString(value);
- }
- }
-
- public int CellPadding {
- get{
- string attr = Attributes["cellpadding"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["cellpadding"] = AttributeToString(value);
- }
- }
-
- public int CellSpacing {
- get{
- string attr = Attributes["cellspacing"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["cellspacing"] = AttributeToString(value);
- }
- }
-
- public string Height {
- get{
- string attr = Attributes["height"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["height"] = AttributeToString(value);
- }
- }
-
- public override string InnerHtml {
- get{
- throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
- }
- set{
- throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
- }
- }
-
- public override string InnerText {
- get{
- throw new NotSupportedException("InnerText property not supported by HtmlTable");
- }
- set{
- throw new NotSupportedException("InnerText property not supported by HtmlTable");
- }
- }
-
- public virtual HtmlTableRowCollection Rows {
- get{
- if (_rows == null) _rows = new HtmlTableRowCollection(this);
- return _rows;
- }
- }
-
- public string Width {
- get{
- string attr = Attributes["width"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["width"] = AttributeToString(value);
- }
- }
-
- protected class HtmlTableRowControlCollection : ControlCollection {
-
- internal HtmlTableRowControlCollection(Control owner): base(owner){}
-
- public override void Add(Control child){
- if ((child as HtmlTableCell) != null){
- base.Add(child);
- }
- else{
- throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
- }
- }
-
- public override void AddAt(int index, Control child){
- if ((child as HtmlTableCell) != null){
- base.AddAt(index,child);
- }
- else{
- throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
- }
- }
- } // end of HtmlTableRowControlCollection
- }
- // end of System.Web.UI.HtmlControl
-}
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlTable : HtmlContainerControl {
+ private HtmlTableRowCollection _rows;
+
+ public HtmlTable():base("table"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableRowControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public int Border {
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public int CellPadding {
+ get{
+ string attr = Attributes["cellpadding"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellpadding"] = AttributeToString(value);
+ }
+ }
+
+ public int CellSpacing {
+ get{
+ string attr = Attributes["cellspacing"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellspacing"] = AttributeToString(value);
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ }
+
+ public virtual HtmlTableRowCollection Rows {
+ get{
+ if (_rows == null) _rows = new HtmlTableRowCollection(this);
+ return _rows;
+ }
+ }
+
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ protected class HtmlTableRowControlCollection : ControlCollection {
+
+ internal HtmlTableRowControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if ((child as HtmlTableCell) != null){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if ((child as HtmlTableCell) != null){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
+ }
+ }
+ } // end of HtmlTableRowControlCollection
+ }
+ // end of System.Web.UI.HtmlControl
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
index 639f97dac90..6815acf909a 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
@@ -1,129 +1,129 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Globalization;
-
-namespace System.Web.UI.HtmlControls{
- public class HtmlTableCell : HtmlContainerControl {
- public HtmlTableCell(): base("td"){}
-
- public HtmlTableCell(string tagName): base(tagName){}
-
- protected new void RenderEndTag(HtmlTextWriter writer){
- base.RenderEndTag(writer);
- writer.WriteLine();
- }
-
- public string Align {
- get{
- string attr = Attributes["align"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["align"] = AttributeToString(value);
- }
- }
-
- public string BgColor {
- get{
- string attr = Attributes["bgcolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bgcolor"] = AttributeToString(value);
- }
- }
-
- public string BorderColor {
- get{
- string attr = Attributes["bordercolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bordercolor"] = AttributeToString(value);
- }
- }
-
- public int ColSpan {
- get{
- string attr = Attributes["colspan"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["colspan"] = AttributeToString(value);
- }
- }
-
- public string Height {
- get{
- string attr = Attributes["height"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["height"] = AttributeToString(value);
- }
- }
-
- public bool NoWrap {
- get{
- string attr = Attributes["colspan"];
- if (attr != null) return attr.Equals("nowrap");
- return false;
- }
- set{
- if (value == true){
- Attributes["nowrap"] = "nowrap";
- }
- else{
- Attributes["nowrap"] = null;
- }
- }
- }
-
- public int RowSpan {
- get{
- string attr = Attributes["rowspan"];
- if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
- return -1;
- }
- set{
- Attributes["rowspan"] = AttributeToString(value);
- }
- }
-
- public string VAlign {
- get{
- string attr = Attributes["valign"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["valign"] = AttributeToString(value);
- }
- }
-
- public string Width {
- get{
- string attr = Attributes["width"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["width"] = AttributeToString(value);
- }
- }
-
- }
- // System.Web.UI.HtmlControls.HtmlTableCell
-
-}
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ public class HtmlTableCell : HtmlContainerControl {
+ public HtmlTableCell(): base("td"){}
+
+ public HtmlTableCell(string tagName): base(tagName){}
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public int ColSpan {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["colspan"] = AttributeToString(value);
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public bool NoWrap {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return attr.Equals("nowrap");
+ return false;
+ }
+ set{
+ if (value == true){
+ Attributes["nowrap"] = "nowrap";
+ }
+ else{
+ Attributes["nowrap"] = null;
+ }
+ }
+ }
+
+ public int RowSpan {
+ get{
+ string attr = Attributes["rowspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["rowspan"] = AttributeToString(value);
+ }
+ }
+
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ }
+ // System.Web.UI.HtmlControls.HtmlTableCell
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
index 8ae40780dcc..9deaf2f0584 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -1,84 +1,84 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Collections;
-
-namespace System.Web.UI.HtmlControls{
- public sealed class HtmlTableCellCollection : ICollection {
- private HtmlTableRow _owner;
-
- internal HtmlTableCellCollection(HtmlTableRow owner){
- _owner = owner;
- }
-
- public void Add(HtmlTableCell cell){
- Insert(-1, cell);
- }
-
- public void Clear(){
- if (_owner.HasControls()) _owner.Controls.Clear();
- }
-
- public void CopyTo(Array array, int index){
- //FIXME: convert to foreach loop
- IEnumerator i = GetEnumerator();
- while(i.MoveNext()){
- array.SetValue(i.Current, index++);
- }
- }
-
- public IEnumerator GetEnumerator(){
- return _owner.Controls.GetEnumerator();
- }
-
- public void Insert(int index, HtmlTableCell cell){
- _owner.Controls.AddAt(index,cell);
- }
-
- public void Remove(HtmlTableCell cell){
- _owner.Controls.Remove(cell);
- }
-
- public void RemoveAt(int index){
- _owner.Controls.RemoveAt(index);
- }
-
- public int Count {
- get{
- if (_owner.HasControls()) return _owner.Controls.Count;
- return 0;
- }
- }
-
- public bool IsReadOnly {
- get{
- return false;
- }
- }
-
- public bool IsSynchronized {
- get{
- return false;
- }
- }
-
- public HtmlTableRow this[int index] {
- get{
- return (HtmlTableRow) _owner.Controls[index];
- }
- }
-
- public object SyncRoot {
- get{
- return null;
- }
- }
-
- } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
-
-}
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableCellCollection : ICollection {
+ private HtmlTableRow _owner;
+
+ internal HtmlTableCellCollection(HtmlTableRow owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableCell cell){
+ Insert(-1, cell);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablecell = this.GetEnumerator();
+ while(tablecell.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablecell.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableCell cell){
+ _owner.Controls.AddAt(index,cell);
+ }
+
+ public void Remove(HtmlTableCell cell){
+ _owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return null;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
index d4c2d6d9bbe..378e149d835 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
@@ -1,138 +1,137 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.HtmlControls{
- public class HtmlTableRow : HtmlContainerControl {
- private HtmlTableCellCollection _cells;
- public HtmlTableRow():base("tr"){}
-
- protected override ControlCollection CreateControlCollection(){
- return new HtmlTableCellControlCollection(this);
- }
-
- protected override void RenderChildren(HtmlTextWriter writer){
- writer.WriteLine();
- writer.Indent = writer.Indent + 1;
- //FIXME: base.RenderChildren();
- writer.Indent = writer.Indent - 1;
- writer.WriteLine();
- }
-
- protected new void RenderEndTag(HtmlTextWriter writer){
- base.RenderEndTag(writer);
- writer.WriteLine();
- }
-
- public string Align {
- get{
- string attr = Attributes["align"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["align"] = AttributeToString(value);
- }
- }
-
- public string BgColor {
- get{
- string attr = Attributes["bgcolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bgcolor"] = AttributeToString(value);
- }
- }
-
- public string BorderColor {
- get{
- string attr = Attributes["bordercolor"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["bordercolor"] = AttributeToString(value);
- }
- }
-
- public virtual HtmlTableCellCollection Cells {
- get{
- if (_cells == null) _cells = new HtmlTableCellCollection(this);
- return _cells;
- }
- }
-
- public string Height {
- get{
- string attr = Attributes["height"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["height"] = AttributeToString(value);
- }
- }
-
- public override string InnerHtml {
- get{
- throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
- }
- set{
- throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
- }
- }
-
- public override string InnerText {
- get{
- throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
- }
- set{
- throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
- }
- }
-
- public string VAlign {
- get{
- string attr = Attributes["valign"];
- if (attr != null) return attr;
- return "";
- }
- set{
- Attributes["valign"] = AttributeToString(value);
- }
- }
-
-
-
- protected class HtmlTableCellControlCollection : ControlCollection {
-
- internal HtmlTableCellControlCollection(Control owner): base(owner){}
-
- public override void Add(Control child){
- if (child is HtmlTableCell){
- base.Add(child);
- }
- else{
- throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
- }
- }
-
- public override void AddAt(int index, Control child){
- if (child is HtmlTableCell){
- base.AddAt(index,child);
- }
- else{
- throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
- }
- }
- }
- } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
- // end of System.Web.UI.HtmlControls.HtmlTableRow
-}
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+ public class HtmlTableRow : HtmlContainerControl {
+ private HtmlTableCellCollection _cells;
+ public HtmlTableRow():base("tr"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableCellControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ this.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public virtual HtmlTableCellCollection Cells {
+ get{
+ if (_cells == null) _cells = new HtmlTableCellCollection(this);
+ return _cells;
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ }
+
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+
+
+ protected class HtmlTableCellControlCollection : ControlCollection {
+
+ internal HtmlTableCellControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if (child is HtmlTableCell){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if (child is HtmlTableCell){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+ }
+ } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
+ // end of System.Web.UI.HtmlControls.HtmlTableRow
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
index 94812e9153d..987c8aed674 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
@@ -1,83 +1,83 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.Collections;
-
-namespace System.Web.UI.HtmlControls{
- public sealed class HtmlTableRowCollection : ICollection {
-
- private HtmlTable _owner;
-
- internal HtmlTableRowCollection(HtmlTable owner){
- _owner = owner;
- }
-
- public void Add(HtmlTableRow row){
- Insert(-1, row);
- }
-
- public void Clear(){
- if (_owner.HasControls()) _owner.Controls.Clear();
- }
-
- public void CopyTo(Array array, int index){
- //FIXME: foreach(IEnumerator i in GetEnumerator()){
- // array.SetValue(i, index+1);
- //}
- }
-
- public IEnumerator GetEnumerator(){
- return _owner.Controls.GetEnumerator();
- }
-
- public void Insert(int index, HtmlTableRow row){
- _owner.Controls.AddAt(index,row);
- }
-
- public void Remove(HtmlTableRow row){
- _owner.Controls.Remove(row);
- }
-
- public void RemoveAt(int index){
- _owner.Controls.RemoveAt(index);
- }
-
- public int Count {
- get{
- if (_owner.HasControls()) return _owner.Controls.Count;
- return 0;
- }
- }
-
- public bool IsReadOnly {
- get{
- return false;
- }
- }
-
- public bool IsSynchronized {
- get{
- return false;
- }
- }
-
- public HtmlTableRow this[int index] {
- get{
- return (HtmlTableRow) _owner.Controls[index];
- }
- }
-
- public object SyncRoot {
- get{
- //LAMESPEC: what to return
- return null;
- }
- }
- }
- // end of System.Web.UI.HtmlControls.HtmlTableRowCollection
-}
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableRowCollection : ICollection {
+
+ private HtmlTable _owner;
+
+ internal HtmlTableRowCollection(HtmlTable owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableRow row){
+ Insert(-1, row);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablerow = this.GetEnumerator();
+ while (tablerow.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablerow.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableRow row){
+ _owner.Controls.AddAt(index,row);
+ }
+
+ public void Remove(HtmlTableRow row){
+ _owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return this;
+ }
+ }
+ }//System.Web.UI.HtmlControls.HtmlTableRowCollection
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
index ccc65227a37..f5652958241 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
@@ -1,119 +1,118 @@
-/* System.Web.UI.HtmlControls
-* Authors
-* Leen Toelen (toelen@hotmail.com)
-*/
-
-using System;
-using System.Web;
-using System.Web.UI;
-using System.ComponentModel;
-using System.Globalization;
-using System.Collections.Specialized;
-
-namespace System.Web.UI.HtmlControls{
-
- public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
-
- private static readonly object EventServerChange;
-
- public HtmlTextArea(): base("textarea"){}
-
- public int Cols{
- get{
- string attr = Attributes["cols"];
- if (attr != null){
- return Int32.Parse(attr, CultureInfo.InvariantCulture);
- }
- return -1;
- }
- set{
- Attributes["cols"] = AttributeToString(value);
- }
- }
-
- public int Rows{
- get{
- string attr = Attributes["rows"];
- if (attr != null){
- return Int32.Parse(attr, CultureInfo.InvariantCulture);;
- }
- return -1;
- }
- set{
- Attributes["rows"] = AttributeToString(value);
- }
- }
-
- public string Value{
- get{
- return InnerHtml;
- }
- set{
- InnerHtml = value;
- }
- }
-
- public virtual string Name{
- get{
- if (UniqueID != null){
- return UniqueID;
- }
- return String.Empty;
- }
- set{}
- }
-
- public event EventHandler ServerChange{
- add{
- Events.AddHandler(EventServerChange, value);
- }
- remove{
- Events.RemoveHandler(EventServerChange, value);
- }
- }
-
- protected virtual void OnServerChange(EventArgs e){
- EventHandler handler;
- handler = (EventHandler) Events[EventServerChange];
- if(handler != null){
- handler.Invoke(this, e);
- }
- }
-
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string currentValue = Value;
- string postedValue = postCollection[postDataKey];
- if (!currentValue.Equals(postedValue) && currentValue != null){
- Value = HttpUtility.HtmlEncode(postedValue);
- return true;
- }
- return false;
-
- }
-
- protected new void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name", Name);
- Attributes.Remove("name");
- base.RenderAttributes(writer);
- }
-
- public void RaisePostDataChangedEvent(){
- OnServerChange(EventArgs.Empty);
- }
-
- protected override void OnPreRender(EventArgs e){
- if(Events[EventServerChange]==null || Disabled){
- ViewState.SetItemDirty("value",false);
- }
- }
-
- protected override void AddParsedSubObject(object obj){
- if (obj is LiteralControl || obj is DataBoundLiteralControl)
- AddParsedSubObject(obj);
- else
- throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
- }
-
- } // class HtmlTextArea
-} // namespace System.Web.UI.HtmlControls
-
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlTextArea(): base("textarea"){}
+
+ public int Cols{
+ get{
+ string attr = Attributes["cols"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["cols"] = AttributeToString(value);
+ }
+ }
+
+ public int Rows{
+ get{
+ string attr = Attributes["rows"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["rows"] = AttributeToString(value);
+ }
+ }
+
+ public string Value{
+ get{
+ return InnerHtml;
+ }
+ set{
+ InnerHtml = value;
+ }
+ }
+
+ public virtual string Name{
+ get{
+ if (UniqueID != null){
+ return UniqueID;
+ }
+ return String.Empty;
+ }
+ set{}
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerChange];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string currentValue = Value;
+ string postedValue = postCollection[postDataKey];
+ if (!currentValue.Equals(postedValue) && currentValue != null){
+ Value = HttpUtility.HtmlEncode(postedValue);
+ return true;
+ }
+ return false;
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if(Events[EventServerChange]==null || Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj is LiteralControl || obj is DataBoundLiteralControl)
+ AddParsedSubObject(obj);
+ else
+ throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
+ }
+
+ } // class HtmlTextArea
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs
index aae60ebd763..70779b7cdaa 100644
--- a/mcs/class/System.Web/System.Web.UI/Control.cs
+++ b/mcs/class/System.Web/System.Web.UI/Control.cs
@@ -596,6 +596,12 @@ namespace System.Web.UI
}
}
+ [MonoTODO("To set a flag to prevent automatic generation of IDs")]
+ internal void PreventAutoID()
+ {
+ throw new NotImplementedException();
+ }
+
//TODO: I think there are some needed Interface implementations to do here.
//TODO: Find api for INamingContainer.
}
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
index 00000000000..ef794771686
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
@@ -0,0 +1,1028 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI{
+
+public class HtmlTextWriter : System.IO.TextWriter {
+
+static HtmlTextWriter(){
+ HtmlTextWriter._tagKeyLookupTable = new Hashtable(97);
+ HtmlTextWriter._tagNameLookupArray = new TagInformation[97];
+ HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);
+ HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);
+ HtmlTextWriter.RegisterTag("acronym", HtmlTextWriterTag.Acronym, TagType.Inline);
+ HtmlTextWriter.RegisterTag("address", HtmlTextWriterTag.Address, TagType.Other);
+ HtmlTextWriter.RegisterTag("area", HtmlTextWriterTag.Area, TagType.Other);
+ HtmlTextWriter.RegisterTag("b", HtmlTextWriterTag.B, TagType.Inline);
+ HtmlTextWriter.RegisterTag("base", HtmlTextWriterTag.Base, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("basefont", HtmlTextWriterTag.Basefont, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("bdo", HtmlTextWriterTag.Bdo, TagType.Inline);
+ HtmlTextWriter.RegisterTag("bgsound", HtmlTextWriterTag.Bgsound, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("big", HtmlTextWriterTag.Big, TagType.Inline);
+ HtmlTextWriter.RegisterTag("blockquote", HtmlTextWriterTag.Blockquote, TagType.Other);
+ HtmlTextWriter.RegisterTag("body", HtmlTextWriterTag.Body, TagType.Other);
+ HtmlTextWriter.RegisterTag("br", HtmlTextWriterTag.Br, TagType.Other);
+ HtmlTextWriter.RegisterTag("button", HtmlTextWriterTag.Button, TagType.Inline);
+ HtmlTextWriter.RegisterTag("caption", HtmlTextWriterTag.Caption, TagType.Other);
+ HtmlTextWriter.RegisterTag("center", HtmlTextWriterTag.Center, TagType.Other);
+ HtmlTextWriter.RegisterTag("cite", HtmlTextWriterTag.Cite, TagType.Inline);
+ HtmlTextWriter.RegisterTag("code", HtmlTextWriterTag.Code, TagType.Inline);
+ HtmlTextWriter.RegisterTag("col", HtmlTextWriterTag.Col, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("colgroup", HtmlTextWriterTag.Colgroup, TagType.Other);
+ HtmlTextWriter.RegisterTag("del", HtmlTextWriterTag.Del, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dd", HtmlTextWriterTag.Dd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dfn", HtmlTextWriterTag.Dfn, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dir", HtmlTextWriterTag.Dir, TagType.Other);
+ HtmlTextWriter.RegisterTag("div", HtmlTextWriterTag.Div, TagType.Other);
+ HtmlTextWriter.RegisterTag("dl", HtmlTextWriterTag.Dl, TagType.Other);
+ HtmlTextWriter.RegisterTag("dt", HtmlTextWriterTag.Dt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("em", HtmlTextWriterTag.Em, TagType.Inline);
+ HtmlTextWriter.RegisterTag("embed", HtmlTextWriterTag.Embed, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("fieldset", HtmlTextWriterTag.Fieldset, TagType.Other);
+ HtmlTextWriter.RegisterTag("font", HtmlTextWriterTag.Font, TagType.Inline);
+ HtmlTextWriter.RegisterTag("form", HtmlTextWriterTag.Form, TagType.Other);
+ HtmlTextWriter.RegisterTag("frame", HtmlTextWriterTag.Frame, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("frameset", HtmlTextWriterTag.Frameset, TagType.Other);
+ HtmlTextWriter.RegisterTag("h1", HtmlTextWriterTag.H1, TagType.Other);
+ HtmlTextWriter.RegisterTag("h2", HtmlTextWriterTag.H2, TagType.Other);
+ HtmlTextWriter.RegisterTag("h3", HtmlTextWriterTag.H3, TagType.Other);
+ HtmlTextWriter.RegisterTag("h4", HtmlTextWriterTag.H4, TagType.Other);
+ HtmlTextWriter.RegisterTag("h5", HtmlTextWriterTag.H5, TagType.Other);
+ HtmlTextWriter.RegisterTag("h6", HtmlTextWriterTag.H6, TagType.Other);
+ HtmlTextWriter.RegisterTag("head", HtmlTextWriterTag.Head, TagType.Other);
+ HtmlTextWriter.RegisterTag("hr", HtmlTextWriterTag.Hr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("html", HtmlTextWriterTag.Html, TagType.Other);
+ HtmlTextWriter.RegisterTag("i", HtmlTextWriterTag.I, TagType.Inline);
+ HtmlTextWriter.RegisterTag("iframe", HtmlTextWriterTag.Iframe, TagType.Other);
+ HtmlTextWriter.RegisterTag("img", HtmlTextWriterTag.Img, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("input", HtmlTextWriterTag.Input, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("ins", HtmlTextWriterTag.Ins, TagType.Inline);
+ HtmlTextWriter.RegisterTag("isindex", HtmlTextWriterTag.Isindex, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("kbd", HtmlTextWriterTag.Kbd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("label", HtmlTextWriterTag.Label, TagType.Inline);
+ HtmlTextWriter.RegisterTag("legend", HtmlTextWriterTag.Legend, TagType.Other);
+ HtmlTextWriter.RegisterTag("li", HtmlTextWriterTag.Li, TagType.Inline);
+ HtmlTextWriter.RegisterTag("link", HtmlTextWriterTag.Link, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("map", HtmlTextWriterTag.Map, TagType.Other);
+ HtmlTextWriter.RegisterTag("marquee", HtmlTextWriterTag.Marquee, TagType.Other);
+ HtmlTextWriter.RegisterTag("menu", HtmlTextWriterTag.Menu, TagType.Other);
+ HtmlTextWriter.RegisterTag("meta", HtmlTextWriterTag.Meta, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("nobr", HtmlTextWriterTag.Nobr, TagType.Inline);
+ HtmlTextWriter.RegisterTag("noframes", HtmlTextWriterTag.Noframes, TagType.Other);
+ HtmlTextWriter.RegisterTag("noscript", HtmlTextWriterTag.Noscript, TagType.Other);
+ HtmlTextWriter.RegisterTag("object", HtmlTextWriterTag.Object, TagType.Other);
+ HtmlTextWriter.RegisterTag("ol", HtmlTextWriterTag.Ol, TagType.Other);
+ HtmlTextWriter.RegisterTag("option", HtmlTextWriterTag.Option, TagType.Other);
+ HtmlTextWriter.RegisterTag("p", HtmlTextWriterTag.P, TagType.Inline);
+ HtmlTextWriter.RegisterTag("param", HtmlTextWriterTag.Param, TagType.Other);
+ HtmlTextWriter.RegisterTag("pre", HtmlTextWriterTag.Pre, TagType.Other);
+ HtmlTextWriter.RegisterTag("q", HtmlTextWriterTag.Q, TagType.Inline);
+ HtmlTextWriter.RegisterTag("rt", HtmlTextWriterTag.Rt, TagType.Other);
+ HtmlTextWriter.RegisterTag("ruby", HtmlTextWriterTag.Ruby, TagType.Other);
+ HtmlTextWriter.RegisterTag("s", HtmlTextWriterTag.S, TagType.Inline);
+ HtmlTextWriter.RegisterTag("samp", HtmlTextWriterTag.Samp, TagType.Inline);
+ HtmlTextWriter.RegisterTag("script", HtmlTextWriterTag.Script, TagType.Other);
+ HtmlTextWriter.RegisterTag("select", HtmlTextWriterTag.Select, TagType.Other);
+ HtmlTextWriter.RegisterTag("small", HtmlTextWriterTag.Small, TagType.Other);
+ HtmlTextWriter.RegisterTag("span", HtmlTextWriterTag.Span, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strike", HtmlTextWriterTag.Strike, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strong", HtmlTextWriterTag.Strong, TagType.Inline);
+ HtmlTextWriter.RegisterTag("style", HtmlTextWriterTag.Style, TagType.Other);
+ HtmlTextWriter.RegisterTag("sub", HtmlTextWriterTag.Sub, TagType.Inline);
+ HtmlTextWriter.RegisterTag("sup", HtmlTextWriterTag.Sup, TagType.Inline);
+ HtmlTextWriter.RegisterTag("table", HtmlTextWriterTag.Table, TagType.Other);
+ HtmlTextWriter.RegisterTag("tbody", HtmlTextWriterTag.Tbody, TagType.Other);
+ HtmlTextWriter.RegisterTag("td", HtmlTextWriterTag.Td, TagType.Inline);
+ HtmlTextWriter.RegisterTag("textarea", HtmlTextWriterTag.Textarea, TagType.Inline);
+ HtmlTextWriter.RegisterTag("tfoot", HtmlTextWriterTag.Tfoot, TagType.Other);
+ HtmlTextWriter.RegisterTag("th", HtmlTextWriterTag.Th, TagType.Inline);
+ HtmlTextWriter.RegisterTag("thead", HtmlTextWriterTag.Thead, TagType.Other);
+ HtmlTextWriter.RegisterTag("title", HtmlTextWriterTag.Title, TagType.Other);
+ HtmlTextWriter.RegisterTag("tr", HtmlTextWriterTag.Tr, TagType.Other);
+ HtmlTextWriter.RegisterTag("tt", HtmlTextWriterTag.Tt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("u", HtmlTextWriterTag.U, TagType.Inline);
+ HtmlTextWriter.RegisterTag("ul", HtmlTextWriterTag.Ul, TagType.Other);
+ HtmlTextWriter.RegisterTag("var", HtmlTextWriterTag.Var, TagType.Inline);
+ HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);
+
+ HtmlTextWriter._attrKeyLookupTable = new Hashtable(40);
+ HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];
+ HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);
+ HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);
+ HtmlTextWriter.RegisterAttribute("alt", HtmlTextWriterAttribute.Alt, true);
+ HtmlTextWriter.RegisterAttribute("background", HtmlTextWriterAttribute.Background, true);
+ HtmlTextWriter.RegisterAttribute("bgcolor", HtmlTextWriterAttribute.Bgcolor, false);
+ HtmlTextWriter.RegisterAttribute("border", HtmlTextWriterAttribute.Border, false);
+ HtmlTextWriter.RegisterAttribute("bordercolor", HtmlTextWriterAttribute.Bordercolor, false);
+ HtmlTextWriter.RegisterAttribute("cellpadding", HtmlTextWriterAttribute.Cellpadding, false);
+ HtmlTextWriter.RegisterAttribute("cellspacing", HtmlTextWriterAttribute.Cellspacing, false);
+ HtmlTextWriter.RegisterAttribute("checked", HtmlTextWriterAttribute.Checked, false);
+ HtmlTextWriter.RegisterAttribute("class", HtmlTextWriterAttribute.Class, true);
+ HtmlTextWriter.RegisterAttribute("cols", HtmlTextWriterAttribute.Cols, false);
+ HtmlTextWriter.RegisterAttribute("colspan", HtmlTextWriterAttribute.Colspan, false);
+ HtmlTextWriter.RegisterAttribute("disabled", HtmlTextWriterAttribute.Disabled, false);
+ HtmlTextWriter.RegisterAttribute("for", HtmlTextWriterAttribute.For, false);
+ HtmlTextWriter.RegisterAttribute("height", HtmlTextWriterAttribute.Height, false);
+ HtmlTextWriter.RegisterAttribute("href", HtmlTextWriterAttribute.Href, true);
+ HtmlTextWriter.RegisterAttribute("id", HtmlTextWriterAttribute.Id, false);
+ HtmlTextWriter.RegisterAttribute("maxlength", HtmlTextWriterAttribute.Maxlength, false);
+ HtmlTextWriter.RegisterAttribute("multiple", HtmlTextWriterAttribute.Multiple, false);
+ HtmlTextWriter.RegisterAttribute("name", HtmlTextWriterAttribute.Name, false);
+ HtmlTextWriter.RegisterAttribute("nowrap", HtmlTextWriterAttribute.Nowrap, false);
+ HtmlTextWriter.RegisterAttribute("onchange", HtmlTextWriterAttribute.Onchange, true);
+ HtmlTextWriter.RegisterAttribute("onclick", HtmlTextWriterAttribute.Onclick, true);
+ HtmlTextWriter.RegisterAttribute("readonly", HtmlTextWriterAttribute.ReadOnly, false);
+ HtmlTextWriter.RegisterAttribute("rows", HtmlTextWriterAttribute.Rows, false);
+ HtmlTextWriter.RegisterAttribute("rowspan", HtmlTextWriterAttribute.Rowspan, false);
+ HtmlTextWriter.RegisterAttribute("rules", HtmlTextWriterAttribute.Rules, false);
+ HtmlTextWriter.RegisterAttribute("selected", HtmlTextWriterAttribute.Selected, false);
+ HtmlTextWriter.RegisterAttribute("size", HtmlTextWriterAttribute.Size, false);
+ HtmlTextWriter.RegisterAttribute("src", HtmlTextWriterAttribute.Src, true);
+ HtmlTextWriter.RegisterAttribute("style", HtmlTextWriterAttribute.Style, false);
+ HtmlTextWriter.RegisterAttribute("tabindex", HtmlTextWriterAttribute.Tabindex, false);
+ HtmlTextWriter.RegisterAttribute("target", HtmlTextWriterAttribute.Target, false);
+ HtmlTextWriter.RegisterAttribute("title", HtmlTextWriterAttribute.Title, true);
+ HtmlTextWriter.RegisterAttribute("type", HtmlTextWriterAttribute.Type, false);
+ HtmlTextWriter.RegisterAttribute("valign", HtmlTextWriterAttribute.Valign, false);
+ HtmlTextWriter.RegisterAttribute("value", HtmlTextWriterAttribute.Value, true);
+ HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);
+ HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);
+
+ HtmlTextWriter._styleKeyLookupTable = new Hashtable(14);
+ HtmlTextWriter._styleNameLookupArray = new String[14];
+ HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);
+ HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);
+ HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);
+ HtmlTextWriter.RegisterStyle("border-color", HtmlTextWriterStyle.BorderColor);
+ HtmlTextWriter.RegisterStyle("border-style", HtmlTextWriterStyle.BorderStyle);
+ HtmlTextWriter.RegisterStyle("border-width", HtmlTextWriterStyle.BorderWidth);
+ HtmlTextWriter.RegisterStyle("color", HtmlTextWriterStyle.Color);
+ HtmlTextWriter.RegisterStyle("font-family", HtmlTextWriterStyle.FontFamily);
+ HtmlTextWriter.RegisterStyle("font-size", HtmlTextWriterStyle.FontSize);
+ HtmlTextWriter.RegisterStyle("font-style", HtmlTextWriterStyle.FontStyle);
+ HtmlTextWriter.RegisterStyle("font-weight", HtmlTextWriterStyle.FontWeight);
+ HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);
+ HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);
+ HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);
+}
+
+public HtmlTextWriter(TextWriter writer):this(writer, " "){}
+
+public HtmlTextWriter(TextWriter writer, string tabString) : base() {
+ writer = writer;
+ tabString = tabString;
+ indentLevel = 0;
+ tabsPending = false;
+ _httpWriter = writer as HttpWriter;
+ _isDescendant = GetType() == typeof(HtmlTextWriter) == false;
+ _attrList = new RenderAttribute[20];
+ _attrCount = 0;
+ _styleList = new RenderStyle[20];
+ _styleCount = 0;
+ _endTags = new TagStackEntry[16];
+ _endTagCount = 0;
+ _inlineCount = 0;
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AttributeInformation attrInfo = HtmlTextWriter._attrNameLookupArray[(int) key];
+ AddAttribute(attrInfo.name, value, key, attrInfo.encode);
+ }
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AddAttribute(HtmlTextWriter._attrNameLookupArray[(int) key].name, value, key, fEncode);
+ }
+}
+
+public virtual void AddAttribute(string name, string value){
+ HtmlTextWriterAttribute attr = GetAttributeKey(name);
+ value = EncodeAttributeValue(GetAttributeKey(name), value);
+ AddAttribute(name, value, attr);
+}
+
+public virtual void AddAttribute(string name, string value, bool fEndode){
+ value = EncodeAttributeValue(value, fEndode);
+ AddAttribute(name, value, GetAttributeKey(name));
+}
+
+protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key){
+ AddAttribute(name, value, key, false);
+}
+
+private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode){
+ if (_attrCount >= (int) _attrList.Length) {
+ RenderAttribute[] rAttrArr = new RenderAttribute[_attrList.Length * 2];
+ System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);
+ _attrList = rAttrArr;
+ }
+ RenderAttribute rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ rAttr.encode = encode;
+ _attrCount++;
+}
+
+public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value){
+ AddStyleAttribute(GetStyleName(key), value, key);
+}
+
+public virtual void AddStyleAttribute(string name, string value){
+ AddStyleAttribute(name, value, GetStyleKey(name));
+}
+
+protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){
+ RenderStyle[] tagRender;
+ RenderStyle beforeTag;
+
+ if (_styleCount > (int) _styleList.Length) {
+ RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2];
+ System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);
+ _styleList = rAttrArr;
+ }
+ RenderStyle rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ _styleCount++;
+}
+
+public override void Close(){
+ writer.Close();
+}
+
+protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value){
+ bool valid = true;
+ if (0 <= (int) attrKey && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ valid = HtmlTextWriter._attrNameLookupArray[(int) attrKey].encode;
+ return EncodeAttributeValue(value, valid);
+}
+
+protected string EncodeAttributeValue(string value, bool fEncode){
+ if (value == null)
+ return null;
+ if (!(fEncode))
+ return value;
+ return System.Web.HttpUtility.HtmlAttributeEncode(value);
+}
+
+protected string EncodeUrl(string url){
+ if (url.IndexOf(SpaceChar) < 0)
+ return url;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ for(int i=0; i <= url.Length; i++){
+ char temp = url[i];
+ if (temp != 32)
+ sb.Append(temp);
+ else
+ sb.Append("%20");
+ }
+ return sb.ToString();
+}
+
+protected virtual void FilterAttributes(){
+ int count = 0;
+ for(int i=0; i <= _styleCount; i++){
+ RenderStyle rStyle = _styleList[i];
+ if (OnStyleAttributeRender(rStyle.name, rStyle.value, rStyle.key)) {
+ count++;
+ }
+ }
+ _styleCount = count;
+ count = 0;
+ for(int i=0; i <= _attrCount; i++){
+ RenderAttribute rAttr = _attrList[i];
+ if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {
+ count++;
+ }
+ }
+ _attrCount = count;
+}
+
+public override void Flush(){
+ writer.Flush();
+}
+
+protected HtmlTextWriterAttribute GetAttributeKey(string attrName){
+ if (attrName != null && attrName.Length > 0) {
+ object attr = HtmlTextWriter._attrKeyLookupTable[attrName.ToLower()];
+ if (attr != null)
+ return (HtmlTextWriterAttribute) attr;
+ }
+ return (HtmlTextWriterAttribute) (-1);
+}
+
+protected string GetAttributeName(HtmlTextWriterAttribute attrKey){
+ if ((int) attrKey >= 0 && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ return HtmlTextWriter._attrNameLookupArray[(int) attrKey].name;
+ return System.String.Empty;
+}
+
+protected HtmlTextWriterStyle GetStyleKey(string styleName){
+ if (styleName != null && styleName.Length > 0) {
+ object style = HtmlTextWriter._styleKeyLookupTable[styleName.ToLower()];
+ if (style != null)
+ return (HtmlTextWriterStyle) style;
+ }
+ return (HtmlTextWriterStyle) (-1);
+}
+
+protected string GetStyleName(HtmlTextWriterStyle styleKey){
+ if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)
+ return HtmlTextWriter._styleNameLookupArray[(int) styleKey];
+ return System.String.Empty;
+}
+
+protected virtual HtmlTextWriterTag GetTagKey(string tagName){
+ if (tagName != null && tagName.Length > 0) {
+ object tag = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower()];
+ if (tag != null)
+ return (HtmlTextWriterTag) tag;
+ }
+ return 0;
+}
+
+protected virtual string GetTagName(HtmlTextWriterTag tagKey){
+ if ((int) tagKey >= 0 && (int) tagKey < HtmlTextWriter._tagNameLookupArray.Length)
+ return HtmlTextWriter._tagNameLookupArray[(int) tagKey].name;
+ return System.String.Empty;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key){
+ for (int i=0; i <= _attrCount; i++) {
+ if (_attrList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key, ref string value){
+ value = null;
+ for (int i=0; i <= _attrCount; i++) {
+ if (_attrList[i].key == key) {
+ value = _attrList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key){
+ for (int i= 0; i <= _styleCount; i++) {
+ if (_styleList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, ref string value){
+ value = null;
+ for( int i=0; i <= _styleCount; i++) {
+ if (_styleList[i].key == key) {
+ value = _styleList[i].value;
+ return true;
+ }
+ }
+ 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 (tabsPending) {
+ for(int i=0; i <= indentLevel; i++) {
+ writer.Write(tabString);
+ }
+ tabsPending = false;
+ }
+}
+
+protected string PopEndTag(){
+ if (_endTagCount <= 0)
+ throw new InvalidOperationException("A PopEndTag was called without a corresponding PushEndTag");
+ _endTagCount--;
+ TagKey = _endTags[_endTagCount].tagKey;
+ return _endTags[_endTagCount].endTagText;
+}
+
+protected void PushEndTag(string endTag){
+ if (_endTagCount >= (int) _endTags.Length) {
+ TagStackEntry[] temp = new TagStackEntry[(int) _endTags.Length * 2];
+ System.Array.Copy(_endTags, temp, (int) _endTags.Length);
+ _endTags = temp;
+ }
+ _endTags[_endTagCount].tagKey = _tagKey;
+ _endTags[_endTagCount].endTagText = endTag;
+ _endTagCount++;
+}
+
+protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key){
+ HtmlTextWriter.RegisterAttribute(name, key, false);
+}
+
+private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool fEncode){
+ name = name.ToLower();
+ HtmlTextWriter._attrKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._attrNameLookupArray.Length)
+ HtmlTextWriter._attrNameLookupArray[(int) key] = new AttributeInformation(name, fEncode);
+}
+
+protected static void RegisterStyle(string name, HtmlTextWriterStyle key){
+ name = name.ToLower();
+ HtmlTextWriter._styleKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._styleNameLookupArray.Length)
+ HtmlTextWriter._styleNameLookupArray[(int) key] = name;
+}
+
+protected static void RegisterTag(string name, HtmlTextWriterTag key){
+ HtmlTextWriter.RegisterTag(name, key, TagType.Other);
+}
+
+private static void RegisterTag(string name, HtmlTextWriterTag key, TagType type){
+ name = name.ToLower();
+ HtmlTextWriter._tagKeyLookupTable.Add(name, key);
+ string fullTag = null;
+ if ((int) type != 1 && (int) key != 0) {
+ fullTag = EndTagLeftChars + name + TagRightChar;
+ }
+ if ((int) key < HtmlTextWriter._tagNameLookupArray.Length)
+ HtmlTextWriter._tagNameLookupArray[(int) key] = new TagInformation(name, type, fullTag);
+}
+
+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(HtmlTextWriterTag tagKey){
+ TagKey = tagKey;
+ bool tagRender = true;
+ if (_isDescendant) {
+ tagRender = OnTagRender(_tagName, _tagKey);
+ FilterAttributes();
+ string beforeTag = RenderBeforeTag();
+ if (beforeTag != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeTag);
+ }
+ }
+ TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];
+ bool tagRendered=true;
+ if (!tagRender)
+ tagRendered = false;
+ if (tagRender) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(_tagName);
+ RenderAttribute rAttr;
+ string rAttrValue = null;
+ for (int i=0; i <= _attrCount; i++) {
+ rAttr = _attrList[i];
+ if (rAttr.key == HtmlTextWriterAttribute.Style)
+ rAttrValue = rAttr.value;
+ else {
+ writer.Write(SpaceChar);
+ writer.Write(rAttr.name);
+ if (rAttr.value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (rAttr.encode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, writer);
+ }
+ else {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(rAttr.value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+ }
+ }
+ if (_styleCount > 0 || rAttrValue != null) {
+ writer.Write(SpaceChar);
+ writer.Write("style");
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ RenderStyle rStyle;
+ for (int i=0; i <= _styleCount; i++) {
+ rStyle = _styleList[i];
+ writer.Write(rStyle.name);
+ writer.Write(StyleEqualsChar);
+ writer.Write(rStyle.value);
+ writer.Write(SemicolonChar);
+ }
+ if (rAttrValue != null)
+ writer.Write(rAttrValue);
+ writer.Write(DoubleQuoteChar);
+ }
+ if (currentTag.tagType == TagType.NonClosing) {
+ writer.Write(SpaceChar);
+ writer.Write(SlashChar);
+ writer.Write(TagRightChar);
+ }
+ else
+ writer.Write(TagRightChar);
+ }
+ string beforeContent = RenderBeforeContent();
+ if (beforeContent != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeContent);
+ }
+ if (tagRendered) {
+ if (currentTag.tagType == TagType.Inline)
+ _inlineCount++;
+ else {
+ WriteLine();
+ Indent++;
+ }
+ if (currentTag.closingTag == null) {
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
+ }
+ }
+ if (_isDescendant) {
+ string afterContent = RenderAfterContent();
+ if (afterContent != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterContent;
+ }
+ string afterTag = RenderAfterTag();
+ if (afterTag != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterTag;
+ }
+ }
+ PushEndTag(currentTag.closingTag);
+ _attrCount = 0;
+ _styleCount = 0;
+}
+
+public virtual void RenderBeginTag(string tagName){
+ TagName = tagName;
+ RenderBeginTag(_tagKey);
+}
+
+public virtual void RenderEndTag(){
+ string endTagText = PopEndTag();
+ if (endTagText != null) {
+ if (HtmlTextWriter._tagNameLookupArray[_tagIndex].tagType == 0) {
+ _inlineCount--;
+ Write(endTagText);
+ }
+ else{
+ WriteLine();
+ Indent--;
+ Write(endTagText);
+ }
+ }
+}
+
+public override void Write(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer);
+}
+
+public override void Write(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer, index, count);
+}
+
+public override void Write(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(s);
+}
+
+public override void Write(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0);
+}
+
+public override void Write(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0, arg1);
+}
+
+public override void Write(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg);
+}
+
+public virtual void WriteAttribute(string name, string value){
+ WriteAttribute(name, value, false);
+}
+
+public virtual void WriteAttribute(string name, string value, bool fEncode){
+ writer.Write(SpaceChar);
+ writer.Write(name);
+ if (value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else{
+ writer.Write(value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+}
+
+public virtual void WriteBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+}
+
+public virtual void WriteEndTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(SlashChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public virtual void WriteFullBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public override void WriteLine(){
+ writer.WriteLine();
+ tabsPending = true;
+}
+
+public override void WriteLine(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer, index, count);
+ tabsPending = true;
+}
+
+public override void WriteLine(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(s);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0, arg1);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg);
+ tabsPending = true;
+}
+
+[CLSCompliant(false)]
+public override void WriteLine(uint value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public void WriteLineNoTabs(string s){
+ writer.WriteLine(s);
+}
+
+public virtual void WriteStyleAttribute(string name, string value){
+ WriteStyleAttribute(name, value, false);
+}
+
+public virtual void WriteStyleAttribute(string name, string value, bool fEncode){
+ writer.Write(name);
+ writer.Write(StyleEqualsChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(value);
+ }
+ writer.Write(SemicolonChar);
+}
+
+public override System.Text.Encoding Encoding {
+ get{
+ return writer.Encoding;
+ }
+}
+
+public int Indent {
+ get{
+ return indentLevel;
+ }
+ set{
+ if (value < 0)
+ value = 0;
+ indentLevel = value;
+ }
+}
+
+public TextWriter InnerWriter {
+ get{
+ return writer;
+ }
+ set{
+ writer = value;
+ _httpWriter = value as HttpWriter;
+ }
+}
+
+public override string NewLine {
+ get{
+ return writer.NewLine;
+ }
+ set{
+ writer.NewLine = value;
+ }
+}
+
+protected HtmlTextWriterTag TagKey {
+ get{
+ return _tagKey;
+ }
+ set{
+ _tagIndex = (int) value;
+ if (_tagIndex < 0 || _tagIndex >= (int) HtmlTextWriter._tagNameLookupArray.Length)
+ throw new ArgumentOutOfRangeException("value");
+ _tagKey = value;
+ if (value != 0)
+ _tagName = HtmlTextWriter._tagNameLookupArray[_tagIndex].name;
+ }
+}
+
+protected string TagName {
+ get{
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ _tagKey = GetTagKey(_tagName);
+ _tagIndex = (int) _tagKey;
+ }
+}
+
+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 = '>';
+
+private int _attrCount;
+private int _endTagCount;
+private int _styleCount;
+private int indentLevel;
+private int _inlineCount;
+private int _tagIndex;
+
+private bool _isDescendant;
+private bool tabsPending;
+
+private HtmlTextWriterTag _tagKey;
+private TextWriter writer;
+private HttpWriter _httpWriter;
+
+private static Hashtable _attrKeyLookupTable;
+private static Hashtable _styleKeyLookupTable;
+private static Hashtable _tagKeyLookupTable;
+
+private string _tagName;
+private string tabString;
+private static string[] _styleNameLookupArray;
+
+private RenderAttribute[] _attrList;
+private static AttributeInformation[] _attrNameLookupArray;
+private static TagInformation[] _tagNameLookupArray;
+private TagStackEntry[] _endTags;
+private RenderStyle[] _styleList;
+
+} //HtmlTextWriter
+
+struct AttributeInformation {
+ public bool encode;
+ public string name;
+
+ public AttributeInformation(string name, bool encode){
+ this.encode = encode;
+ this.name = name;
+ }
+}
+
+struct RenderAttribute {
+ public bool encode;
+ public HtmlTextWriterAttribute key;
+ public string name;
+ public string value;
+}
+
+struct RenderStyle {
+ public HtmlTextWriterStyle key;
+ public string name;
+ public string value;
+}
+
+struct TagInformation {
+ public string closingTag;
+ public string name;
+ public TagType tagType;
+
+ public TagInformation(string name, TagType tagType, string closingTag){
+ this.name = name;
+ this.tagType = tagType;
+ this.closingTag = closingTag;
+ }
+}
+
+struct TagStackEntry {
+ public string endTagText;
+ public HtmlTextWriterTag tagKey;
+}
+
+enum TagType {
+ Inline,
+ NonClosing,
+ Other
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
index 43d122afa9d..5b82723c5c3 100644
--- a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
@@ -1,58 +1,54 @@
-//
-// System.Web.UI.HtmlTextWriterAttribute.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Web;
-
-namespace System.Web.UI
-{
- 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
- }
-}
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+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,
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
index 7c45d758724..4955422d668 100644
--- a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
@@ -1,32 +1,28 @@
-//
-// System.Web.UI.HtmlTextWriterStyle.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Web;
-
-namespace System.Web.UI
-{
- public enum HtmlTextWriterStyle
- {
- BackgroundColor,
- BackgroundImage,
- BorderCollapse,
- BorderColor,
- BorderStyle,
- BorderWidth,
- Color,
- FontFamily,
- FontSize,
- FontStyle,
- FontWeight,
- Height,
- TextDecoration,
- Width
- }
-}
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterStyle {
+BackgroundColor,
+BackgroundImage,
+BorderCollapse,
+BorderColor,
+BorderStyle,
+BorderWidth,
+Color,
+FontFamily,
+FontSize,
+FontStyle,
+FontWeight,
+Height,
+TextDecoration,
+Width
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
index 2cf2bc8c28c..f248979246a 100644
--- a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
@@ -1,115 +1,111 @@
-//
-// System.Web.UI.HtmlTextWriterTag.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Web;
-
-namespace System.Web.UI
-{
- public enum HtmlTextWriterTag
- {
- 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,
- Unknown,
- Var,
- Wbr,
- Xml
- }
-}
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+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
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+