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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2001-11-05 10:10:08 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-11-05 10:10:08 +0300
commit7c9ee1a3eee8ba8eda6fc266f2936d3930d40248 (patch)
treee74daf17f9abd8c479280e02683ecf8c3e004439 /mcs/class/System.Web/System.Web.UI.HtmlControls
parent7eb2c92598dd09f9600ac131c3a677500315d7a7 (diff)
Flush pending changes I got from a contributor that did not put his name in
svn path=/trunk/mcs/; revision=1263
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.HtmlControls')
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs152
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs160
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs126
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs47
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs15
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs20
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs39
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs13
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs26
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs18
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs58
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs24
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs328
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs69
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs29
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs67
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs33
22 files changed, 696 insertions, 679 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
index 02997962128..bd319d61b54 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
@@ -9,33 +9,30 @@ using System.Web.UI;
namespace System.Web.UI.HtmlControls{
- public class HtmlAnchor : HtmlContainerControl, IPostBackDataHandler{
+ public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
- private static readonly object EventServerChange;
+ 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);
- }
+ if(handler != null) handler.Invoke(this, e);
}
- protected override void RenderAttributes(HtmlTextWriter writer);{
- if ((EventHandler) Events[EventServerClick] != null){
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ if ( (EventHandler) Events[EventServerClick] != null){
Attributes.Remove("href");
RenderAttributes(writer);
writer.WriteAttribute(Page.GetPostBackClientHyperlink(this,""),"href");
}
else{
- PreProcessRelativeReferenceAttribute(writer,"href");
+ PreProcessRelativeReference(writer,"href");
RenderAttributes(writer);
}
}
- //FIXME: not sure about the accessor
public void RaisePostBackEvent(string eventArgument){
OnServerClick(EventArgs.Empty);
}
@@ -49,56 +46,47 @@ namespace System.Web.UI.HtmlControls{
}
}
- public int HRef{
+ public string HRef{
get{
string attr = Attributes["href"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- //MapIntegerAttributeToString(value) accessible constraint is "assembly"
- Attributes["href"] = MapIntegerAttributeToString(value);
+ Attributes["href"] = AttributeToString(value);
}
}
public string Name{
get{
string attr = Attributes["name"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["name"] = MapStringAttributeToString(value);
+ Attributes["name"] = AttributeToString(value);
}
}
public string Target{
get{
string attr = Attributes["target"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["target"] = MapStringAttributeToString(value);
+ Attributes["target"] = AttributeToString(value);
}
}
public string Title{
get{
string attr = Attributes["title"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["title"] = MapStringAttributeToString(value);
+ Attributes["title"] = AttributeToString(value);
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
index a5a7f739c09..d96d21ca9c0 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
@@ -9,9 +9,9 @@ using System.Web.UI;
namespace System.Web.UI.HtmlControls{
- public class HtmlButton : HtmlContainerControl, IPostBackDataHandler{
+ public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
- private static readonly object EventServerChange;
+ private static readonly object EventServerClick;
public HtmlButton(): base("button"){}
@@ -23,23 +23,20 @@ namespace System.Web.UI.HtmlControls{
}
}
- //FIXME: check function
- protected override void RenderAttributes(HtmlTextWriter writer){
+ protected new void RenderAttributes(HtmlTextWriter writer){
if (Page != null && Events[EventServerClick] != null){
- Util.WriteOnClickAttribute(
+ System.Web.UI.Util.WriteOnClickAttribute(
writer,
this,
false,
true,
CausesValidation == false? Page.Validators.Count > 0: false);
}
- RenderAttributes(writer);
-
+ base.RenderAttributes(writer);
}
- //FIXME: not sure about the accessor
public void RaisePostBackEvent(string eventArgument){
- if (CausesValidation = false){
+ if (CausesValidation){
Page.Validate();
}
OnServerClick(EventArgs.Empty);
@@ -56,11 +53,11 @@ namespace System.Web.UI.HtmlControls{
public bool CausesValidation{
get{
- object causesVal = ViewState["CausesValidation"];
- if (causesVal != null){
- return (Boolean) causesVal;
+ object attr = ViewState["CausesValidation"];
+ if (attr != null){
+ return (Boolean) attr;
}
- return 1;
+ return true;
}
set{
ViewState["CausesValidation"] = (Boolean) value;
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
index cdb5d28e97f..e10b8cc2241 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
@@ -1,75 +1,83 @@
//
// System.Web.UI.HtmlControls.HtmlContainerControl.cs
//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-//LAMESPEC: The dox talk about HttpException but are very ambigious.
-//TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
-//case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
-//to do anything with children.
-// a doc references this. add? protected override ControlCollection CreateControlCollection();
-
-//TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
-// Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
-//[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
-// System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
-// ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
-// System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
-// System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
-// System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
-// System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
-// System.Web.UI.Page.ProcessRequestMain() +660
-
-
-namespace System.Web.UI.HtmlControls
-{
- public abstract class HtmlContainerControl : HtmlControl
- {
- private string _innterHtml = "";
- private string _innterText = "";
- private bool _doText = false;
- private bool _doChildren = true;
- 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;
- }
- }
- public override Render(HtmlTextWriter writer)
- {
- if(_doChildren) RenderChildren(writer);
- else if(_doText) Page.Server.HtmlEncode(_innerText, writer);
- else writer.Write(_innerHtml);
- }
- }
-}
+// 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){}
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
index d58f7c8a3ab..de8c00f0b18 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
@@ -1,60 +1,106 @@
//
// System.Web.UI.HtmlControls.HtmlControl.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 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;
- }
- 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;
- }
- }
- }
-}
+// 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;
+ }
+ }
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
index b7707af1482..ddf8ed4274f 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -9,143 +9,139 @@ using System.Web.UI;
namespace System.Web.UI.HtmlControls{
- public class HtmlForm : HtmlContainerControl, IPostBackDataHandler{
+ public class HtmlForm : HtmlContainerControl{
private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
public HtmlForm(): base("form"){}
-
-
- protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name",RenderedNameAttribute);
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
Attributes.Remove("name");
writer.WriteAttribute("method",Method);
Attributes.Remove("method");
- writer.WriteAttribute("action",GetActionAttribute,true);
+ 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")
+ clientOnSubmit = String.Concat(clientOnSubmit,Attributes["onsubmit"]);
+ Attributes.Remove("onsubmit");
}
writer.WriteAttribute("language","javascript");
writer.WriteAttribute("onsubmit",clientOnSubmit);
}
- if (ID != null){
+ if (ID == null){
writer.WriteAttribute("id",ClientID);
}
- RenderAttributes(writer);
+ base.RenderAttributes(writer);
}
+ //TODO: adapt code for non-IE browsers
protected override void Render(HtmlTextWriter output){
- if (Page.SmartNavigation != null){
- UI.IAttributeAccessor.SetAttribute("_smartNavEnabled","true");
+ if (Page.SmartNavigation == true){
+ IAttributeAccessor.SetAttribute("_smartNavigation","true");
HttpBrowserCapabilities browserCap = Context.Request.Browser;
- if (Browser.ToLower != "ie"){
- Render(output);
+ if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
+ base.Render(output);
return;
}
- else if (browserCap.MajorVersion > 5){
- output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>"
- if (browerCap.MinorVersion > 0.5 && browserCap.MajorVersion != 5){
- Page.RegisterClientScriptFileInternal("SmartNavIncludeScript","JScript","SmartNavIE5.js");
- }
- else{
- if (Page.IsPostBack){
- Page.RegisterClientScriptFileInternal("SmartNavIncludeScript","JScript","SmartNav.js");
- }
- }
- }
- Render(output);
+ 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);
- RenderChildren(writer);
+ base.RenderChildren(writer);
Page.OnFormPostRender(writer,ClientID);
}
protected override void OnInit(EventArgs e){
- OnInit(e);
- Page.RegisterViewStateHandler;
+ base.OnInit(e);
+ Page.RegisterViewStateHandler();
}
- private string GetActionAttribute(){
- string loc0 = Context.Request.CurrentExecutionFilePath;
- string loc1 = Context.Request.FilePath;
- if (loc1.ReferenceEquals(loc0) != true){
- loc2 = loc1;
- int loc3 = loc2.LastIndexOf(G);
- if (loc3 < 0) goto progres;
- loc2 = loc2.Substring(loc3+1)
- }
- else{
- loc2 = Util.Version.SBSVersionString(loc1,loc0);
- }
- progres:
- string loc4 = Context.Request.QueryStringText;
- if (loc4 != null && loc4.Length > 0){
- loc2 = String.Concat(loc2,"\?",loc4);
+ 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;
}
- return loc2;
}
public string EncType{
get{
- string attrEncType = Attributes["enctype"];
- if (attrEncType != null){
- return attrEncType;
+ string attr = Attributes["enctype"];
+ if (attr != null){
+ return attr;
}
return null;
}
set{
- Attributes["enctype"] = MapStringAttributeToString(value);
+ Attributes["enctype"] = AttributeToString(value);
}
}
public string Method{
get{
- string attrMethod = Attributes["method"];
- if (attrMethod != null){
- return attrMethod;
+ string attr = Attributes["method"];
+ if (attr != null){
+ return attr;
}
return "post";
}
set{
- Attributes["method"] = MapStringAttributeToString(value);
+ Attributes["method"] = AttributeToString(value);
}
}
public string Target{
get{
- string attrTarget = Attributes["target"];
- if (attrTarget != null){
- return attrTarget;
+ string attr = Attributes["target"];
+ if (attr != null){
+ return attr;
}
return "";
}
set{
- Attributes["target"] = MapStringAttributeToString(value);
+ Attributes["target"] = AttributeToString(value);
}
}
public string Name{
get{
- string attrName = Attributes["name"];
- if (attrName != null){
- return attrName;
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
}
return "";
}
}
- protected string RenderedNameAttribute{
+ internal string RenderedName{
get{
- string attrName = Name;
- if (attrName.Length > 0){
- return attrName;
+ string attr = Name;
+ if (attr.Length > 0){
+ return attr;
}
return UniqueID;
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
index b805e5c9008..c56fe0eceaa 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
@@ -1,21 +1,32 @@
-/
+//
// System.Web.UI.HtmlControls.HtmlGenericControl.cs
//
// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.HtmlControls
-{
- public class HtmlGenericControl : HtmlContainerControl
- {
- public HtmlContainerControl() : base(); {}
- public HtmlContainerControl(string tag) : base(tag) {}
- }
-}
+ // Bob Smith <bob@thestuff.net>
+ //
+ // (C) Bob Smith
+ //
+
+ using System;
+ using System.Web;
+ using System.Web.UI;
+
+ namespace System.Web.UI.HtmlControls{
+
+ public class HtmlGenericControl : HtmlContainerControl {
+
+ public HtmlGenericControl(){}
+
+ public HtmlGenericControl(string tag): base(tag){}
+
+ public new string TagName {
+ get
+ {
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ }
+ }
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
index 97cf3a47ae7..fbc67139c55 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -14,8 +14,8 @@ namespace System.Web.UI.HtmlControls{
public HtmlImage(): base("img"){}
- protected override void RenderAttributes(HtmlTextWriter writer){
- PreProcessRelativeReferenceAttribute(writer,"src");
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
RenderAttributes(writer);
writer.Write(" /");
}
@@ -29,7 +29,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["align"] = MapStringAttributeToString(value);
+ Attributes["align"] = AttributeToString(value);
}
}
@@ -42,7 +42,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["alt"] = MapStringAttributeToString(value);
+ Attributes["alt"] = AttributeToString(value);
}
}
@@ -55,7 +55,7 @@ namespace System.Web.UI.HtmlControls{
return -1;
}
set{
- Attributes["border"] = MapIntegerAttributeToString(value);
+ Attributes["border"] = AttributeToString(value);
}
}
@@ -68,7 +68,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["src"] = MapStringAttributeToString(value);
+ Attributes["src"] = AttributeToString(value);
}
}
@@ -81,11 +81,10 @@ namespace System.Web.UI.HtmlControls{
return -1;
}
set{
- Attributes["width"] = MapIntegerAttributeToString(value);
+ Attributes["width"] = AttributeToString(value);
}
}
} // class HtmlImage
} // namespace System.Web.UI.HtmlControls
-
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
index c626a189360..416d5cbc895 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
@@ -12,11 +12,11 @@ namespace System.Web.UI.HtmlControls{
public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
- private static readonly object EventServerChange;
+ private static readonly object EventServerClick;
public HtmlInputButton(string type): base(type){}
- protected void OnServerClick(ImageClickEventArgs e){
+ protected void OnServerClick(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerClick];
if (handler != null){
handler.Invoke(this, e);
@@ -25,7 +25,7 @@ namespace System.Web.UI.HtmlControls{
protected override void RenderAttributes(HtmlTextWriter writer){
string attrType = Type;
- bool ofTypeSubmit = String.Compare(attrType, "submit", true) == false;
+ bool ofTypeSubmit = (String.Compare(attrType, "submit", true) == 0);
bool events;
if (ofTypeSubmit != true){
events = (Events[EventServerClick] != null);
@@ -35,7 +35,7 @@ namespace System.Web.UI.HtmlControls{
}
if (Page != null){
if (ofTypeSubmit != true){
- Util.WriteOnClickAttribute(
+ System.Web.UI.Util.WriteOnClickAttribute(
writer,
this,
false,
@@ -43,8 +43,8 @@ namespace System.Web.UI.HtmlControls{
CausesValidation == false? Page.Validators.Count > 0: false);
}
else{
- if (events != true && String.Compare(attrType,"button", true) != null){
- Util.WriteOnClickAttribute(
+ if (events != true && String.Compare(attrType,"button", true) != 0){
+ System.Web.UI.Util.WriteOnClickAttribute(
writer,
this,
false,
@@ -53,14 +53,14 @@ namespace System.Web.UI.HtmlControls{
}
}
}
- RenderAttributes(writer);
+ base.RenderAttributes(writer);
}
- public override IPostBackEventHandler RaisePostBackEvent(string eventArgument){
- if (CausesValidation != null){
+ public void RaisePostBackEvent(string eventArgument){
+ if(CausesValidation == true){
Page.Validate();
}
- OnServerClick(new ImageClickEventArgs(_x, _y));
+ OnServerClick(EventArgs.Empty);
}
public event EventHandler ServerClick{
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
index 2eb91f4719e..0c2d397339c 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
@@ -15,40 +15,31 @@ namespace System.Web.UI.HtmlControls{
private static readonly object EventServerChange;
- public HtmlInputCheckBox: base("checkbox"){}
+ public HtmlInputCheckBox(): base("checkbox"){}
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string postValue = postCollection[postDataKey];
- bool greaterthan;
- if (postValue != null){
- greaterthan = postValue.Length > 0;
- }
- else{
- greaterthan = false;
- }
- bool equalcheck = greaterthan == Checked == false;
- Checked = greaterthan;
- return equalcheck;
+ bool postChecked = false;
+ if (postValue != null)
+ postChecked = postValue.Length > 0;
+ Checked = postChecked;
+ return (postChecked == Checked == false);
}
- public override void RaisePostDataChangedEvent(){
+ public void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
protected void OnServerChange(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null){
- handler.Invoke(this, e);
- }
+ if (handler != null) handler.Invoke(this, e);
}
- protected void OnPreRender(EventArgs e){
- if (Page != null && !Disabled){
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled)
Page.RegisterRequiresPostBack(this);
- }
- if (Events[EventServerChange] != null && !Disabled){
+ if (Events[EventServerChange] != null && !Disabled)
ViewState.SetItemDirty("checkbox",false);
- }
}
public event EventHandler ServerChange{
@@ -63,16 +54,12 @@ namespace System.Web.UI.HtmlControls{
public bool Checked{
get{
string attr = Attributes["checked"];
- if (attr != null){
+ if (attr != null)
return attr.Equals("checked");
- }
return false;
}
set{
- if (value != true){
- Attributes["checked"] = null;
- }
- Attributes["checked"] = "checked";
+ Attributes["checked"] = (value == true)? "checked": null;
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
index 084a30002a7..bf0fafc33aa 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
@@ -16,10 +16,10 @@ namespace System.Web.UI.HtmlControls{
Attributes["type"] = type;
}
- protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name",RenderedNameAttribute);
+ protected virtual new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
Attributes.Remove("name");
- RenderAttributes(writer);
+ base.RenderAttributes(writer);
writer.Write(" /");
}
@@ -30,7 +30,7 @@ namespace System.Web.UI.HtmlControls{
set{}
}
- protected string RenderedNameAttribute{
+ protected virtual string RenderedName{
get{
return Name;
}
@@ -46,7 +46,7 @@ namespace System.Web.UI.HtmlControls{
}
}
- public string Value{
+ public virtual string Value{
get{
string attr = Attributes["value"];
if (attr != null){
@@ -55,10 +55,9 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["value"] = MapStringAttributeToString(value);
+ Attributes["value"] = AttributeToString(value);
}
}
} // class HtmlInputControl
} // namespace System.Web.UI.HtmlControls
-
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
index 3aa569d70a0..855a9756fe7 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
@@ -15,58 +15,54 @@ namespace System.Web.UI.HtmlControls{
public HtmlInputFile():base("file"){}
- public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string postValue = postCollection[postDataKey];
- if (postValue != null){
+ if (postValue != null)
Value = postValue;
- }
return false;
}
- public void RaisePostDataChangedEvent(){}
+ public virtual void RaisePostDataChangedEvent(){}
public string Accept{
get{
string attr = Attributes["accept"];
- if (attr != null){
+ if (attr != null)
return attr;
- }
return "";
}
set{
- Attributes["accept"] = MapStringAttributeToString(value);
+ Attributes["accept"] = AttributeToString(value);
}
}
public int MaxLength{
get{
string attr = Attributes["maxlength"];
- if (attr != null){
+ if (attr != null)
return Int32.Parse(attr, CultureInfo.InvariantCulture);
- }
return -1;
}
set{
- Attributes["accept"] = MapIntegerAttributeToString(value);
+ Attributes["accept"] = AttributeToString(value);
}
}
public int Size{
get{
string attr = Attributes["size"];
- if (attr != null){
- return Int32.Parse(attr);
- }
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["size"] = MapIntegerAttributeToString(value);
+ Attributes["size"] = AttributeToString(value);
}
}
public HttpPostedFile PostedFile{
get{
- return Context.Request.Files[RenderedNameAttribute];
+ return Context.Request.Files[RenderedName];
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
index ad6c0930358..53fc29fbaf4 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
@@ -11,35 +11,31 @@ using System.Collections.Specialized;
namespace System.Web.UI.HtmlControls{
- public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
+ public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
private static readonly object EventServerChange;
- public HtmlInputFile(string type):base("file"){}
+ public HtmlInputHidden(string type):base("hidden"){}
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string postValue = postCollection[postDataKey];
- if (postValue != null){
+ if (postValue != null)
Value = postValue;
- }
return false;
}
- public override void RaisePostDataChangedEvent(){
+ public virtual void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
protected void OnServerChange(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null){
- handler.Invoke(this, e);
- }
+ if (handler != null) handler.Invoke(this, e);
}
- protected void OnPreRender(EventArgs e){
- if (Events[EventServerChange] != null && !Disabled){
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled)
ViewState.SetItemDirty("value",false);
- }
}
public event EventHandler ServerChange{
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
index 7f86f25ef65..eacbed41cc2 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
@@ -7,17 +7,18 @@ 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 EventServerChange;
+ private static readonly object EventServerClick;
private int _x, _y;
public HtmlInputImage(): base("image"){}
- protected void OnPreRender(EventArgs e){
+ protected override void OnPreRender(EventArgs e){
if (Page != null && !Disabled){
Page.RegisterRequiresPostBack(this);
}
@@ -25,15 +26,13 @@ namespace System.Web.UI.HtmlControls{
protected void OnServerClick(ImageClickEventArgs e){
ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
- if (handler != null){
- handler.Invoke(this, e);
- }
+ if (handler != null) handler.Invoke(this, e);
}
protected override void RenderAttributes(HtmlTextWriter writer){
- PreProcessRelativeReferenceAttribute(writer,"src");
+ PreProcessRelativeReference(writer,"src");
if (Page != null && !CausesValidation){
- Util.WriteOnClickAttribute(
+ System.Web.UI.Util.WriteOnClickAttribute(
writer,
this,
false,
@@ -44,8 +43,8 @@ namespace System.Web.UI.HtmlControls{
}
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
- string postX = postCollection[String.Concat(RenderedNameAttribute,".x")];
- string postY = postCollection[String.Concat(RenderedNameAttribute,".y")];
+ 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);
@@ -54,15 +53,15 @@ namespace System.Web.UI.HtmlControls{
return false;
}
- public override void RaisePostDataChangedEvent(){}
-
- public override IPostBackEventHandler RaisePostBackEvent(string eventArgument){
- if (CausesValidation != null){
+ public void RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
Page.Validate();
}
- OnServerClick(new ImageClickEventArgs(_x, _y));
+ OnServerClick(new ImageClickEventArgs(_x,_y));
}
+ public void RaisePostDataChangedEvent(){}
+
public event EventHandler ServerClick{
add{
Events.AddHandler(EventServerClick, value);
@@ -75,48 +74,40 @@ namespace System.Web.UI.HtmlControls{
public string Align{
get{
string attr = Attributes["align"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["align"] = MapStringAttributeToString(value);
+ Attributes["align"] = AttributeToString(value);
}
}
public string Alt{
get{
string attr = Attributes["alt"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["alt"] = MapStringAttributeToString(value);
+ Attributes["alt"] = AttributeToString(value);
}
}
public int Border{
get{
string attr = Attributes["border"];
- if (attr != null){
- return Int32.Parse(attr,CultureInfo.InvariantCulture);
- }
+ if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["border"] = MapIntegerAttributeToString(value);
+ Attributes["border"] = AttributeToString(value);
}
}
public bool CausesValidation{
get{
object causesVal = ViewState["CausesValidation"];
- if (causesVal != null){
- return (Boolean) causesVal;
- }
+ if (causesVal != null) return (Boolean) causesVal;
return true;
}
set{
@@ -127,18 +118,13 @@ namespace System.Web.UI.HtmlControls{
public string Src{
get{
string attr = Attributes["src"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["src"] = MapStringAttributeToString(value);
+ Attributes["src"] = AttributeToString(value);
}
}
-
- public event ServerClick;
-
} // class HtmlInputImage
} // namespace System.Web.UI.HtmlControls
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
index 9bf3e4ccf3f..9ee60f34b7c 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
@@ -15,9 +15,9 @@ namespace System.Web.UI.HtmlControls{
private static readonly object EventServerChange;
- public HtmlInputRadioButton: base("radio"){}
+ public HtmlInputRadioButton(): base("radio"){}
- protected void OnPreRender(EventArgs e){
+ protected override void OnPreRender(EventArgs e){
if (Page != null && !Disabled){
Page.RegisterRequiresPostBack(this);
}
@@ -33,7 +33,7 @@ namespace System.Web.UI.HtmlControls{
}
}
- protected void RenderAttributes(HtmlTextWriter writer){
+ protected override void RenderAttributes(HtmlTextWriter writer){
writer.WriteAttribute("value", Value);
Attributes.Remove("value");
RenderAttributes(writer);
@@ -41,7 +41,7 @@ namespace System.Web.UI.HtmlControls{
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string postValue = postCollection[postDataKey];
- bool myBool;
+ bool myBool = false;
if (postValue != null && postValue.Equals(Value)){
if (!Checked){
Checked = true;
@@ -57,7 +57,7 @@ namespace System.Web.UI.HtmlControls{
return myBool;
}
- public override void RaisePostDataChangedEvent(){
+ public void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
@@ -85,7 +85,7 @@ namespace System.Web.UI.HtmlControls{
Attributes["checked"] = "checked";
}
}
- public string Name{
+ public new string Name{
get{
string attr = Attributes["name"];
if (attr != null){
@@ -94,19 +94,19 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["name"] = value.MapStringAttributeToString("name");
+ Attributes["name"] = AttributeToString(value);
}
}
- private string RenderedNameAttribute{
+ private new string RenderedName{
get{
- string renderedName = base.RenderedNameAttribute;
+ string attr = base.RenderedName;
string id = UniqueID;
int indexOfX = id.LastIndexOf('X');
- if (indexOfX != 0 && indexOfX !< 0){
- renderedName = renderedName.Concat(id.Substring(0,indexOfX+1), renderedName);
+ if (indexOfX != 0 && indexOfX >= 0){
+ attr = String.Concat(attr, id.Substring(0,indexOfX+1));
}
- return renderedName;
+ return attr;
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
index 0b16b69c9ef..24a7cfcd4e1 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
@@ -18,7 +18,7 @@ namespace System.Web.UI.HtmlControls{
public HtmlInputText(string type):base(type){}
public HtmlInputText():base("text"){}
- protected void OnPreRender(EventArgs e){
+ protected override void OnPreRender(EventArgs e){
if (Events[EventServerChange] != null && !Disabled){
ViewState.SetItemDirty("value",false);
}
@@ -26,13 +26,12 @@ namespace System.Web.UI.HtmlControls{
protected void OnServerChange(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null){
- handler.Invoke(this, e);
- }
+ if (handler != null) handler.Invoke(this, e);
}
- protected void RenderAttributes(HtmlTextWriter writer){
- if (!String.Compare(Type, "password", true)){
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ //hide value when password box
+ if (String.Compare(Type, "password") != 0){
ViewState.Remove("value");
}
RenderAttributes(writer);
@@ -40,15 +39,15 @@ namespace System.Web.UI.HtmlControls{
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string currentValue = Value;
- string postValue = postCollection.GetValues[];
- if (!currentValue.Equals(postValue){
- Value = postValue;
+ string[] postedValue = postCollection.GetValues(postDataKey);
+ if (!currentValue.Equals(postedValue)){
+ Value = postedValue[0];
return true;
}
return false;
}
- public override void RaisePostDataChangedEvent(){
+ public void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
@@ -63,40 +62,34 @@ namespace System.Web.UI.HtmlControls{
public int MaxLength{
get{
- string currentMaxLength = (String) ViewState["maxlength"];
- if (currentMaxLength != null){
- return Int32.Parse(currentMaxLength, CultureInfo.InvariantCulture);
- }
+ string attr = (String) ViewState["maxlength"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["maxlength"] = MapIntegerAttributeToString(value);
+ Attributes["maxlength"] = AttributeToString(value);
}
}
public int Size{
get{
- string currentMaxLength = (String) ViewState["size"];
- if (currentMaxLength != null){
- return Int32.Parse(currentMaxLength, CultureInfo.InvariantCulture);
- }
+ string attr = (String) ViewState["size"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["size"] = MapIntegerAttributeToString(value);
+ Attributes["size"] = AttributeToString(value);
}
}
- public string Value{
+ public override string Value{
get{
string attr = Attributes["value"];
- if (attr != null){
- return attr;
- }
+ if (attr != null) return attr;
return "";
}
set{
- Attributes["value"] = MapStringAttributeToString(value);
+ Attributes["value"] = AttributeToString(value);
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
index a328698569c..ce0584584e4 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -8,27 +8,26 @@ 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, IPostBackDatHandler, IParserAccessor{
+ public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
- private int cachedSelectedIndex;
- private object dataSource;
+ private int _cachedSelectedIndex = -1;
+ private object _dataSource;
private static readonly object EventServerChange;
- private ListItemCollection items;
- private static readonly char[] SPLIT_CHARS;
+ private ListItemCollection _items;
- public HtmlSelectt():base("select"){}
+ public HtmlSelect():base("select"){}
protected override void AddParsedSubObject(object obj){
- if (this is ListItem){
- Items.Add((ListItem) obj);
- return
- }
- throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlSelect",obj.GetType.Name);
+ 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(){
@@ -37,81 +36,69 @@ namespace System.Web.UI.HtmlControls{
}
}
- protected override ControlCollection CreateControlCollection()){
+ protected override ControlCollection CreateControlCollection(){
return new EmptyControlCollection(this);
}
protected override void LoadViewState(object savedState){
- Triplet loc0;
- object loc1;
if (savedState != null){
- loc0 = (Triplet) savedState;
- LoadViewSate(loc0.First);
- LoadViewState(loc0.Second);
- loc1 = loc0.Third;
- if (loc1 != null){
- Select((Int32) loc1);
- }
+ 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){
- bool loc1 = false;
- string resolvedDataSource = DataTextField;
- string loc3 = DataValueField;
- Items.Clear;
- ICollection loc4 = resolvedDataSource as ICollection;
- if loc4 != null){
- Items.Capacity = loc4.Count;
- }
- if loc2.Length != 0){
- if (loc3.Length != 0) goto label1;
+ 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;
}
- loc1 = false;
- label1:
- for(IEnumerator 7 = loc0.GetEnumerator; loc7.MoveNext != null){
- object loc5 = loc7.Current;
- ListItem loc6 = new ListItem();
- if (resolvedDataSource != null){
- if (loc2.Length > 0){
- loc6.Text = DataBinder.GetPropertyValue(loc5,loc2,null);
- }
- if (loc3.Length > 0){
- loc6.Value = DataBinder.GetPropertyValue(loc5,loc3,null)
- }
- }
- else{
- string loc8 = loc5.ToString;
- loc6.Value = loc8;
- loc6.Text = loc8;
- }
- e.Items.Add(loc6);
+ 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;
+ if ( _cachedSelectedIndex != -1){
+ SelectedIndex = _cachedSelectedIndex;
+ _cachedSelectedIndex = -1;
}
}
protected override void OnPreRender(EventArgs e){
- if (Page != null && Size >= 1 && !Disabled){
+ if (Page != null && Size >= 0 && !Disabled){
Page.RegisterRequiresPostBack(this);
}
}
protected virtual void OnServerChange(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerChange];
- if (handler != null){
+ if (handler != null)
handler.Invoke(this,e);
- }
}
- protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name", RenderedNameAttribute);
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
Attributes.Remove("name");
Attributes.Remove("DataValueField");
Attributes.Remove("DataTextField");
@@ -120,63 +107,109 @@ namespace System.Web.UI.HtmlControls{
}
protected override void RenderChildren(HtmlTextWriter writer){
+ //flush output
writer.WriteLine();
+ // increase indent level, improves readability
writer.Indent = writer.Indent + 1;
- ListItemCollection itemsCollection = Items;
- int itemsCount = itemsCollection.Count;
- if (itemsCount > 0){
- for (int i = 0; i <= itemsCount; i++){
- ListItem item = itemsCollection[i];
+ 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 (item.Selected != null){
+ if (option.Selected == true){
writer.WriteAttribute("selected","selected");
}
- writer.WriteAttribute("value",item.Value,true);
- item.Attributes.Remove("text");
- item.Attributes.Remove("value");
- item.Attributes.Remove("selected");
- item.Attributes.Render(writer);
- writer.Write('b');
- HttpUtility.HtmlEncode(item.Text, writer);
+ 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();
}
- writer.Indent = writer.Indent - 1;
}
+ // set the indent level back to normal
+ writer.Indent = writer.Indent - 1;
}
protected override object SaveViewState(){
- object obj0 = SaveViewState;
- object obj1 = Items.SaveViewState;
- object obj2 = null;
+ //TODO: find some better names, out of inspiration
+ object itemsViewState = SaveViewState();
+ object third = null;
if (Events[EventServerChange] != null && !Disabled && Visible){
- obj2 = SelectIndices;
+ third = SelectedIndices;
}
- if (obj2 != null && obj1 != null && obj0 != null){
- return new Triplet(obj0, obj1, obj3);
+ if (third != null && base.SaveViewState() != null && itemsViewState != null){
+ return new Triplet(itemsViewState, base.SaveViewState(), third);
}
return null;
}
protected virtual void Select(int[] selectedIndices){
- ClearSelection;
- for (int i = 0; selectedIndices[i] < 0; i++){
- if (selectedIndices[i] <= Items.Count){
- Items[selectedIndices[i].Selected = true;
+ // 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;
}
}
}
- private bool System.Web.UI.IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection){
- //TODO: implement me
+ 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;
}
- private void System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent(){
+ public void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
protected override void TrackViewState(){
- base.TrackViewState[this].TrackViewState;
+ base.TrackViewState();
+ Items.TrackViewState();
}
public event EventHandler ServerChange{
@@ -187,31 +220,29 @@ namespace System.Web.UI.HtmlControls{
Events.RemoveHandler(EventServerChange, value);
}
}
-
+
public virtual string DataMember{
get{
object viewStateDataMember = ViewState["DataMember"];
- if ( viewStateDataMember != null){
- return (String) viewStateDataMember;
- }
+ if ( viewStateDataMember != null) return (String) viewStateDataMember;
return String.Empty;
}
set{
- Attributes["DataMember"] = MapStringAttributeToString(value);
+ Attributes["DataMember"] = AttributeToString(value);
}
}
public virtual object DataSource{
get{
- return dataSource;
+ return _dataSource;
}
set{
if (value != null && value is IListSource){
if (value is IEnumerable){
- dataSource = value;
+ _dataSource = value;
}
else{
- throw new ArgumentException("Invalid_DataSource_Type", value, HttpRuntime.FormatResourceString(ID));
+ throw new ArgumentException("Invalid dataSource type");
}
}
}
@@ -226,141 +257,122 @@ namespace System.Web.UI.HtmlControls{
return String.Empty;
}
set{
- Attributes["DataTextField"] = MapStringAttributeToString(value);
+ Attributes["DataTextField"] = AttributeToString(value);
}
}
public virtual string DataValueField{
get{
string attr = Attributes["DataValueField"];
- if (attr != null){
- return attr;
- }
+ if (attr != null)return attr;
return String.Empty;
}
set{
- Attributes["DataValueField"] = MapStringAttributeToString(value);
+ Attributes["DataValueField"] = AttributeToString(value);
}
}
public override string InnerHtml{
get{
- throw new NotSupportedException("InnerHtml_not_supported", this, HttpRuntime.FormatResourceString(GetType.Name);
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
}
set{
- throw new NotSupportedException("InnerHtml_not_supported", this, HttpRuntime.FormatResourceString(GetType.Name);
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
}
}
public override string InnerText{
get{
- throw new NotSupportedException("InnerText_not_supported", this, HttpRuntime.FormatResourceString(GetType.Name);
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
}
set{
- throw new NotSupportedException("InnerText_not_supported", this, HttpRuntime.FormatResourceString(GetType.Name);
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
}
}
public ListItemCollection Items{
get{
- if (items == null){
- items = new ListItemCollection();
- if (IsTrackingViewState == true){
- items.TrackViewState;
- }
+ if (_items == null){
+ _items = new ListItemCollection();
+ if (IsTrackingViewState) _items.TrackViewState();
}
- return items;
+ return _items;
}
}
public bool Multiple{
get{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
- }
- return "";
+ string attr = Attributes["multiple"];
+ if (attr != null) return attr.Equals("multiple");
+ return false;
}
set{
- Attributes[""] = MapStringAttributeToString(value);
+ if (value == true) Attributes["multiple"] = "multiple";
+ else Attributes["multiple"] = null;
}
}
public string Name{
get{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes[""] = MapStringAttributeToString(value);
- }
- }
-
- internal string RenderedNameAttribute{
- get{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
- }
- return "";
+ return UniqueID;
}
set{
- Attributes[""] = MapStringAttributeToString(value);
+ //LAMESPEC
+ return;
}
}
public virtual int SelectedIndex {
get{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
+ 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 "";
+ return -1;
}
set{
- Attributes[""] = MapStringAttributeToString(value);
+ //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{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
- }
- return "";
- }
- set{
- Attributes[""] = MapStringAttributeToString(value);
+ //TODO: check function
+ return null;
}
}
public int Size{
get{
- string attr = Attributes[""];
+ string attr = Attributes["size"];
if (attr != null){
- return attr;
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
}
- return "";
+ return -1;
}
set{
- Attributes[""] = MapStringAttributeToString(value);
+ Attributes["size"] = AttributeToString(value);
}
}
public string Value{
get{
- string attr = Attributes[""];
- if (attr != null){
- return attr;
+ int selectedIndex = SelectedIndex;
+ if (selectedIndex >=0 && selectedIndex <= Items.Count){
+ return Items[selectedIndex].Value;
}
- return "";
+ return String.Empty;
}
set{
- Attributes[""] = MapStringAttributeToString(value);
+ int findValue = Items.FindByValueInternal(value);
+ if (findValue >= 0) SelectedIndex = findValue;
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
index 0060bf18761..4e3d402bd9c 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
@@ -6,28 +6,29 @@
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");
+
+ public HtmlTable():base("table"){}
protected override ControlCollection CreateControlCollection(){
- return new HtmlTableRowControlCollection;
+ return new HtmlTableRowControlCollection(this);
}
protected override void RenderChildren(HtmlTextWriter writer){
writer.WriteLine();
writer.Indent = writer.Indent + 1;
- base.RenderChildren;
+ base.RenderChildren(writer);
writer.Indent = writer.Indent - 1;
}
- protected override void RenderEndTag(HtmlTextWriter writer){
+ protected new void RenderEndTag(HtmlTextWriter writer){
base.RenderEndTag(writer);
- writer.WriteLine;
+ writer.WriteLine();
}
public string Align {
@@ -37,7 +38,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["align"] = MapStringAttributeToString(value);
+ Attributes["align"] = AttributeToString(value);
}
}
@@ -48,18 +49,18 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bgcolor"] = MapStringAttributeToString(value);
+ Attributes["bgcolor"] = AttributeToString(value);
}
}
public int Border {
get{
string attr = Attributes["border"];
- if (attr != null) return return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["border"] = MapIntegerAttributeToString(value);
+ Attributes["border"] = AttributeToString(value);
}
}
@@ -70,32 +71,32 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bordercolor"] = MapStringAttributeToString(value);
+ Attributes["bordercolor"] = AttributeToString(value);
}
}
public int CellPadding {
get{
string attr = Attributes["cellpadding"];
- if (attr != null) return return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["cellpadding"] = MapIntegerAttributeToString(value);
+ Attributes["cellpadding"] = AttributeToString(value);
}
}
public int CellSpacing {
get{
string attr = Attributes["cellspacing"];
- if (attr != null) return return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["cellspacing"] = MapIntegerAttributeToString(value);
+ Attributes["cellspacing"] = AttributeToString(value);
}
}
-
+
public string Height {
get{
string attr = Attributes["height"];
@@ -103,63 +104,65 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["height"] = MapStringAttributeToString(value);
+ Attributes["height"] = AttributeToString(value);
}
}
-
+
public override string InnerHtml {
get{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
}
set{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
}
}
public override string InnerText {
get{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
}
set{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
}
}
-
+
public virtual HtmlTableRowCollection Rows {
get{
- if (_rows == null) _rows = new HtmlTableRowCollection;
+ if (_rows == null) _rows = new HtmlTableRowCollection(this);
return _rows;
}
}
- public string Height {
+ public string Width {
get{
string attr = Attributes["width"];
if (attr != null) return attr;
return "";
}
set{
- Attributes["width"] = MapStringAttributeToString(value);
+ Attributes["width"] = AttributeToString(value);
}
- }
- private protected class HtmlTableRowControlCollection : ControlCollection {
- internal HtmlTableCellControlCollection(Control owner): base(owner);
+ }
+
+ protected class HtmlTableRowControlCollection : ControlCollection {
+
+ internal HtmlTableRowControlCollection(Control owner): base(owner){}
public override void Add(Control child){
- if (child Is HtmlTableCell){
+ if ((child as HtmlTableCell) != null){
base.Add(child);
}
else{
- throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
}
}
public override void AddAt(int index, Control child){
- if (child Is HtmlTableCell){
+ if ((child as HtmlTableCell) != null){
base.AddAt(index,child);
}
else{
- throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
}
}
} // end of HtmlTableRowControlCollection
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
index a1bba324e5b..639f97dac90 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
@@ -6,14 +6,15 @@
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(): base("td"){}
- public HtmlTableCell(string tagName): base(tagName);
+ public HtmlTableCell(string tagName): base(tagName){}
- protected override void RenderEndTag(HtmlTextWriter writer){
+ protected new void RenderEndTag(HtmlTextWriter writer){
base.RenderEndTag(writer);
writer.WriteLine();
}
@@ -25,7 +26,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["align"] = MapStringAttributeToString(value);
+ Attributes["align"] = AttributeToString(value);
}
}
@@ -36,7 +37,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bgcolor"] = MapStringAttributeToString(value);
+ Attributes["bgcolor"] = AttributeToString(value);
}
}
@@ -47,18 +48,18 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bordercolor"] = MapStringAttributeToString(value);
+ Attributes["bordercolor"] = AttributeToString(value);
}
}
public int ColSpan {
get{
string attr = Attributes["colspan"];
- if (attr != null) return return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["colspan"] = MapIntegerAttributeToString(value);
+ Attributes["colspan"] = AttributeToString(value);
}
}
@@ -69,14 +70,14 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["height"] = MapStringAttributeToString(value);
+ Attributes["height"] = AttributeToString(value);
}
}
public bool NoWrap {
get{
string attr = Attributes["colspan"];
- if (attr != null) return String.Equals("nowrap");
+ if (attr != null) return attr.Equals("nowrap");
return false;
}
set{
@@ -92,11 +93,11 @@ namespace System.Web.UI.HtmlControls{
public int RowSpan {
get{
string attr = Attributes["rowspan"];
- if (attr != null) return return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
return -1;
}
set{
- Attributes["rowspan"] = MapIntegerAttributeToString(value);
+ Attributes["rowspan"] = AttributeToString(value);
}
}
@@ -107,7 +108,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["valign"] = MapStringAttributeToString(value);
+ Attributes["valign"] = AttributeToString(value);
}
}
@@ -118,7 +119,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["width"] = MapStringAttributeToString(value);
+ Attributes["width"] = AttributeToString(value);
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
index 8958f1b4f7a..8ae40780dcc 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -6,6 +6,7 @@
using System;
using System.Web;
using System.Web.UI;
+using System.Collections;
namespace System.Web.UI.HtmlControls{
public sealed class HtmlTableCellCollection : ICollection {
@@ -20,18 +21,19 @@ namespace System.Web.UI.HtmlControls{
}
public void Clear(){
- if (_owner.HasConrols) _owner.Conrols.Clear;
+ if (_owner.HasControls()) _owner.Controls.Clear();
}
public void CopyTo(Array array, int index){
- IEnumerator i = GetEnumerator;
- while(i.MoveNext){
+ //FIXME: convert to foreach loop
+ IEnumerator i = GetEnumerator();
+ while(i.MoveNext()){
array.SetValue(i.Current, index++);
}
}
public IEnumerator GetEnumerator(){
- return _owner.Controls.GetEnumerator;
+ return _owner.Controls.GetEnumerator();
}
public void Insert(int index, HtmlTableCell cell){
@@ -48,7 +50,7 @@ namespace System.Web.UI.HtmlControls{
public int Count {
get{
- if (_owner.HasConrols) return _owner.Controls.Count;
+ if (_owner.HasControls()) return _owner.Controls.Count;
return 0;
}
}
@@ -67,13 +69,16 @@ namespace System.Web.UI.HtmlControls{
public HtmlTableRow this[int index] {
get{
- return (HtmlTableCell) _owner.Controls[index];
+ return (HtmlTableRow) _owner.Controls[index];
}
}
- public object SyncRoot {};
+ public object SyncRoot {
+ get{
+ return null;
+ }
+ }
} // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
}
-
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
index 4548c6ca3b7..d4c2d6d9bbe 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
@@ -10,22 +10,23 @@ using System.Web.UI;
namespace System.Web.UI.HtmlControls{
public class HtmlTableRow : HtmlContainerControl {
private HtmlTableCellCollection _cells;
- public HtmlTableRow():base("tr");
+ public HtmlTableRow():base("tr"){}
protected override ControlCollection CreateControlCollection(){
- return new HtmlYableCellControlCollection(this);
+ return new HtmlTableCellControlCollection(this);
}
protected override void RenderChildren(HtmlTextWriter writer){
writer.WriteLine();
writer.Indent = writer.Indent + 1;
- base.RenderChildren;
+ //FIXME: base.RenderChildren();
writer.Indent = writer.Indent - 1;
+ writer.WriteLine();
}
- protected override void RenderEndTag(HtmlTextWriter writer){
+ protected new void RenderEndTag(HtmlTextWriter writer){
base.RenderEndTag(writer);
- writer.WriteLine;
+ writer.WriteLine();
}
public string Align {
@@ -35,7 +36,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["align"] = MapStringAttributeToString(value);
+ Attributes["align"] = AttributeToString(value);
}
}
@@ -46,7 +47,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bgcolor"] = MapStringAttributeToString(value);
+ Attributes["bgcolor"] = AttributeToString(value);
}
}
@@ -57,7 +58,7 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["bordercolor"] = MapStringAttributeToString(value);
+ Attributes["bordercolor"] = AttributeToString(value);
}
}
@@ -75,25 +76,25 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["height"] = MapStringAttributeToString(value);
+ Attributes["height"] = AttributeToString(value);
}
}
public override string InnerHtml {
get{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
}
set{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
}
}
public override string InnerText {
get{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
}
set{
- throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
}
}
@@ -104,30 +105,32 @@ namespace System.Web.UI.HtmlControls{
return "";
}
set{
- Attributes["valign"] = MapStringAttributeToString(value);
+ Attributes["valign"] = AttributeToString(value);
}
}
- }
-
- private 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(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
- }
- }
- public override void AddAt(int index, Control child){
- if (child Is HtmlTableCell){
- base.AddAt(index,child);
- }
- else{
- throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
+ 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
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
index 0a07eaf5b37..94812e9153d 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
@@ -6,6 +6,7 @@
using System;
using System.Web;
using System.Web.UI;
+using System.Collections;
namespace System.Web.UI.HtmlControls{
public sealed class HtmlTableRowCollection : ICollection {
@@ -21,18 +22,17 @@ namespace System.Web.UI.HtmlControls{
}
public void Clear(){
- if (_owner.HasConrols) _owner.Conrols.Clear;
+ if (_owner.HasControls()) _owner.Controls.Clear();
}
public void CopyTo(Array array, int index){
- IEnumerator i = GetEnumerator;
- while(i.MoveNext){
- array.SetValue(i.Current, index++);
- }
+ //FIXME: foreach(IEnumerator i in GetEnumerator()){
+ // array.SetValue(i, index+1);
+ //}
}
public IEnumerator GetEnumerator(){
- return _owner.Controls.GetEnumerator;
+ return _owner.Controls.GetEnumerator();
}
public void Insert(int index, HtmlTableRow row){
@@ -49,7 +49,7 @@ namespace System.Web.UI.HtmlControls{
public int Count {
get{
- if (_owner.HasConrols) return _owner.Controls.Count;
+ if (_owner.HasControls()) return _owner.Controls.Count;
return 0;
}
}
@@ -72,8 +72,12 @@ namespace System.Web.UI.HtmlControls{
}
}
- public object SyncRoot {};
+ public object SyncRoot {
+ get{
+ //LAMESPEC: what to return
+ return null;
+ }
+ }
}
// end of System.Web.UI.HtmlControls.HtmlTableRowCollection
}
-
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
index 1adf2771dfd..ccc65227a37 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
@@ -27,8 +27,7 @@ namespace System.Web.UI.HtmlControls{
return -1;
}
set{
- //MapIntegerAttributeToString(value) accessible constraint is "assembly"
- Attributes["cols"] = MapIntegerAttributeToString(value);
+ Attributes["cols"] = AttributeToString(value);
}
}
@@ -41,8 +40,7 @@ namespace System.Web.UI.HtmlControls{
return -1;
}
set{
- //MapIntegerAttributeToString(value) accessible constraint is "assembly"
- Attributes["rows"] = MapIntegerAttributeToString(value);
+ Attributes["rows"] = AttributeToString(value);
}
}
@@ -54,13 +52,7 @@ namespace System.Web.UI.HtmlControls{
InnerHtml = value;
}
}
-
- protected string RenderedNameAttribute{
- get{
- return Name;
- }
- }
-
+
public virtual string Name{
get{
if (UniqueID != null){
@@ -88,7 +80,6 @@ namespace System.Web.UI.HtmlControls{
}
}
- //FIXME: not sure about the accessor
public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
string currentValue = Value;
string postedValue = postCollection[postDataKey];
@@ -100,31 +91,27 @@ namespace System.Web.UI.HtmlControls{
}
- protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name", RenderedNameAttribute);
- base.Attributes.Remove("name");
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
base.RenderAttributes(writer);
}
- //FIXME: not sure about the accessor
public void RaisePostDataChangedEvent(){
OnServerChange(EventArgs.Empty);
}
protected override void OnPreRender(EventArgs e){
- if(Events[EventServerChange]==null || Disabled==true){
+ if(Events[EventServerChange]==null || Disabled){
ViewState.SetItemDirty("value",false);
}
}
protected override void AddParsedSubObject(object obj){
- //FIXME: not sure about this function
- if (obj is LiteralControl || obj is DataBoundLiteralControl){
+ if (obj is LiteralControl || obj is DataBoundLiteralControl)
AddParsedSubObject(obj);
- return;
- }
- //FormatResourceString accessible constraint is "assembly"
- throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTextArea",obj.GetType.Name));
+ else
+ throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
}
} // class HtmlTextArea