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