1 /* System.Web.UI.HtmlControls
\r
3 * Leen Toelen (toelen@hotmail.com)
\r
7 using System.ComponentModel;
\r
10 using System.Globalization;
\r
12 namespace System.Web.UI.HtmlControls{
\r
14 [ParseChildren(true, "Rows")]
\r
15 public class HtmlTable : HtmlContainerControl {
\r
16 private HtmlTableRowCollection _rows;
\r
18 public HtmlTable():base("table"){}
\r
20 protected override ControlCollection CreateControlCollection(){
\r
21 return new HtmlTableRowControlCollection(this);
\r
24 protected override void RenderChildren(HtmlTextWriter writer){
\r
26 writer.Indent = writer.Indent + 1;
\r
27 base.RenderChildren(writer);
\r
28 writer.Indent = writer.Indent - 1;
\r
31 protected override void RenderEndTag(HtmlTextWriter writer){
\r
32 base.RenderEndTag(writer);
\r
37 [WebCategory("Layout")]
\r
38 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
39 public string Align {
\r
41 string attr = Attributes["align"];
\r
42 if (attr != null) return attr;
\r
43 return String.Empty;
\r
46 Attributes["align"] = AttributeToString(value);
\r
51 [WebCategory("Appearance")]
\r
52 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
53 public string BgColor {
\r
55 string attr = Attributes["bgcolor"];
\r
56 if (attr != null) return attr;
\r
57 return String.Empty;
\r
60 Attributes["bgcolor"] = AttributeToString(value);
\r
65 [WebCategory("Appearance")]
\r
66 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
69 string attr = Attributes["border"];
\r
70 if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
\r
74 Attributes["border"] = AttributeToString(value);
\r
79 [WebCategory("Appearance")]
\r
80 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
81 public string BorderColor {
\r
83 string attr = Attributes["bordercolor"];
\r
84 if (attr != null) return attr;
\r
85 return String.Empty;
\r
88 Attributes["bordercolor"] = AttributeToString(value);
\r
93 [WebCategory("Appearance")]
\r
94 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
95 public int CellPadding {
\r
97 string attr = Attributes["cellpadding"];
\r
98 if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
\r
102 Attributes["cellpadding"] = AttributeToString(value);
\r
107 [WebCategory("Appearance")]
\r
108 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
109 public int CellSpacing {
\r
111 string attr = Attributes["cellspacing"];
\r
112 if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
\r
116 Attributes["cellspacing"] = AttributeToString(value);
\r
121 [WebCategory("Layout")]
\r
122 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
123 public string Height {
\r
125 string attr = Attributes["height"];
\r
126 if (attr != null) return attr;
\r
127 return String.Empty;
\r
130 Attributes["height"] = AttributeToString(value);
\r
134 public override string InnerHtml {
\r
136 throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
\r
139 throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
\r
143 public override string InnerText {
\r
145 throw new NotSupportedException("InnerText property not supported by HtmlTable");
\r
148 throw new NotSupportedException("InnerText property not supported by HtmlTable");
\r
152 [IgnoreUnknownContent ()]
\r
154 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
155 public virtual HtmlTableRowCollection Rows {
\r
157 if (_rows == null) _rows = new HtmlTableRowCollection(this);
\r
163 [WebCategory("Layout")]
\r
164 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
\r
165 public string Width {
\r
167 string attr = Attributes["width"];
\r
168 if (attr != null) return attr;
\r
169 return String.Empty;
\r
172 Attributes["width"] = AttributeToString(value);
\r
176 protected class HtmlTableRowControlCollection : ControlCollection {
\r
178 internal HtmlTableRowControlCollection(Control owner): base(owner){}
\r
180 public override void Add(Control child){
\r
181 if ((child as HtmlTableRow) != null){
\r
185 throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
\r
189 public override void AddAt(int index, Control child){
\r
190 if ((child as HtmlTableRow) != null){
\r
191 base.AddAt(index,child);
\r
194 throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
\r
197 } // end of HtmlTableRowControlCollection
\r
199 // end of System.Web.UI.HtmlControl
\r