2 // System.Web.UI.HtmlControls.HtmlTableRow.cs
5 // Sebastien Pouliot <sebastien@ximian.com>
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.ComponentModel;
30 using System.Security.Permissions;
32 namespace System.Web.UI.HtmlControls {
35 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
36 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
38 [ParseChildren (true, "Cells")]
39 public class HtmlTableRow : HtmlContainerControl {
41 private HtmlTableCellCollection _cells;
44 public HtmlTableRow ()
51 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
52 [WebSysDescription("")]
53 [WebCategory("Layout")]
56 string s = Attributes ["align"];
57 return (s == null) ? String.Empty : s;
61 Attributes.Remove ("align");
63 Attributes ["align"] = value;
68 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
69 [WebSysDescription("")]
70 [WebCategory("Appearance")]
71 public string BgColor {
73 string s = Attributes ["bgcolor"];
74 return (s == null) ? String.Empty : s;
78 Attributes.Remove ("bgcolor");
80 Attributes ["bgcolor"] = value;
85 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
86 [WebSysDescription("")]
87 [WebCategory("Appearance")]
88 public string BorderColor {
90 string s = Attributes ["bordercolor"];
91 return (s == null) ? String.Empty : s;
95 Attributes.Remove ("bordercolor");
97 Attributes ["bordercolor"] = value;
102 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
103 public virtual HtmlTableCellCollection Cells {
106 _cells = new HtmlTableCellCollection (this);
112 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
113 [WebSysDescription("")]
114 [WebCategory("Layout")]
115 public string Height {
117 string s = Attributes ["height"];
118 return (s == null) ? String.Empty : s;
122 Attributes.Remove ("height");
124 Attributes ["height"] = value;
128 public override string InnerHtml {
129 get { throw new NotSupportedException (); }
130 set { throw new NotSupportedException (); }
133 public override string InnerText {
134 get { throw new NotSupportedException (); }
135 set { throw new NotSupportedException (); }
139 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
140 [WebSysDescription("")]
141 [WebCategory("Layout")]
142 public string VAlign {
144 string s = Attributes ["valign"];
145 return (s == null) ? String.Empty : s;
149 Attributes.Remove ("valign");
151 Attributes ["valign"] = value;
156 get { return (_cells == null) ? 0 : _cells.Count; }
160 protected override ControlCollection CreateControlCollection ()
162 return new HtmlTableCellControlCollection (this);
170 override void RenderChildren (HtmlTextWriter writer)
172 if (HasControls ()) {
174 base.RenderChildren (writer);
180 protected override void RenderEndTag (HtmlTextWriter writer)
184 writer.WriteEndTag (TagName);
185 if (writer.Indent == 0)
190 protected class HtmlTableCellControlCollection : ControlCollection {
192 internal HtmlTableCellControlCollection (HtmlTableRow owner)
197 public override void Add (Control child)
200 throw new NullReferenceException ("null");
201 if (!(child is HtmlTableCell))
202 throw new ArgumentException ("child", Locale.GetText ("Must be an HtmlTableCell instance."));
207 public override void AddAt (int index, Control child)
210 throw new NullReferenceException ("null");
211 if (!(child is HtmlTableCell))
212 throw new ArgumentException ("child", Locale.GetText ("Must be an HtmlTableCell instance."));
214 base.AddAt (index, child);