mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
* System.Web.UI/Control.cs: don't throw exception in ControlID. By now, it returns ID. * System.Web.UI/Page.cs: (ProcessRequest): implemented. * System.Web.UI.HtmlControls/HtmlAnchor.cs: (RenderAttributes): new -> override and fixed little bug that made it cause an stack overflow. * System.Web.UI.HtmlControls/HtmlContainerControl.cs: reformatted and added tag and its attributes rendering. * System.Web.UI.HtmlControls/HtmlGenericControl.cs: removed TagName, which is already in HtmlControl. * System.Web.UI.HtmlControls/HtmlTable.cs: (RenderEndTag): new -> override. svn path=/trunk/mcs/; revision=5117
172 lines
4.0 KiB
C#
Executable File
172 lines
4.0 KiB
C#
Executable File
/* System.Web.UI.HtmlControls
|
|
* Authors
|
|
* Leen Toelen ([email protected])
|
|
*/
|
|
|
|
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 override void RenderEndTag(HtmlTextWriter writer){
|
|
base.RenderEndTag(writer);
|
|
writer.WriteLine();
|
|
}
|
|
|
|
public string Align {
|
|
get{
|
|
string attr = Attributes["align"];
|
|
if (attr != null) return attr;
|
|
return String.Empty;
|
|
}
|
|
set{
|
|
Attributes["align"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public string BgColor {
|
|
get{
|
|
string attr = Attributes["bgcolor"];
|
|
if (attr != null) return attr;
|
|
return String.Empty;
|
|
}
|
|
set{
|
|
Attributes["bgcolor"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public int Border {
|
|
get{
|
|
string attr = Attributes["border"];
|
|
if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
|
|
return -1;
|
|
}
|
|
set{
|
|
Attributes["border"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public string BorderColor {
|
|
get{
|
|
string attr = Attributes["bordercolor"];
|
|
if (attr != null) return attr;
|
|
return String.Empty;
|
|
}
|
|
set{
|
|
Attributes["bordercolor"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public int CellPadding {
|
|
get{
|
|
string attr = Attributes["cellpadding"];
|
|
if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
|
|
return -1;
|
|
}
|
|
set{
|
|
Attributes["cellpadding"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public int CellSpacing {
|
|
get{
|
|
string attr = Attributes["cellspacing"];
|
|
if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
|
|
return -1;
|
|
}
|
|
set{
|
|
Attributes["cellspacing"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public string Height {
|
|
get{
|
|
string attr = Attributes["height"];
|
|
if (attr != null) return attr;
|
|
return String.Empty;
|
|
}
|
|
set{
|
|
Attributes["height"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
public override string InnerHtml {
|
|
get{
|
|
throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
|
|
}
|
|
set{
|
|
throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
|
|
}
|
|
}
|
|
|
|
public override string InnerText {
|
|
get{
|
|
throw new NotSupportedException("InnerText property not supported by HtmlTable");
|
|
}
|
|
set{
|
|
throw new NotSupportedException("InnerText property not supported by HtmlTable");
|
|
}
|
|
}
|
|
|
|
public virtual HtmlTableRowCollection Rows {
|
|
get{
|
|
if (_rows == null) _rows = new HtmlTableRowCollection(this);
|
|
return _rows;
|
|
}
|
|
}
|
|
|
|
public string Width {
|
|
get{
|
|
string attr = Attributes["width"];
|
|
if (attr != null) return attr;
|
|
return String.Empty;
|
|
}
|
|
set{
|
|
Attributes["width"] = AttributeToString(value);
|
|
}
|
|
}
|
|
|
|
protected class HtmlTableRowControlCollection : ControlCollection {
|
|
|
|
internal HtmlTableRowControlCollection(Control owner): base(owner){}
|
|
|
|
public override void Add(Control child){
|
|
if ((child as HtmlTableCell) != null){
|
|
base.Add(child);
|
|
}
|
|
else{
|
|
throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
|
|
}
|
|
}
|
|
|
|
public override void AddAt(int index, Control child){
|
|
if ((child as HtmlTableCell) != null){
|
|
base.AddAt(index,child);
|
|
}
|
|
else{
|
|
throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
|
|
}
|
|
}
|
|
} // end of HtmlTableRowControlCollection
|
|
}
|
|
// end of System.Web.UI.HtmlControl
|
|
}
|