2 // System.Web.UI.HtmlControls.HtmlTableRow.cs
5 // Sebastien Pouliot <sebastien@ximian.com>
7 // Copyright (C) 2005-2010 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 HtmlTableCellCollection _cells;
43 public HtmlTableRow ()
49 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
50 [WebSysDescription("")]
51 [WebCategory("Layout")]
54 string s = Attributes ["align"];
55 return (s == null) ? String.Empty : s;
59 Attributes.Remove ("align");
61 Attributes ["align"] = value;
66 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
67 [WebSysDescription("")]
68 [WebCategory("Appearance")]
69 public string BgColor {
71 string s = Attributes ["bgcolor"];
72 return (s == null) ? String.Empty : s;
76 Attributes.Remove ("bgcolor");
78 Attributes ["bgcolor"] = value;
83 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
84 [WebSysDescription("")]
85 [WebCategory("Appearance")]
86 public string BorderColor {
88 string s = Attributes ["bordercolor"];
89 return (s == null) ? String.Empty : s;
93 Attributes.Remove ("bordercolor");
95 Attributes ["bordercolor"] = value;
100 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
101 public virtual HtmlTableCellCollection Cells {
104 _cells = new HtmlTableCellCollection (this);
110 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
111 [WebSysDescription("")]
112 [WebCategory("Layout")]
113 public string Height {
115 string s = Attributes ["height"];
116 return (s == null) ? String.Empty : s;
120 Attributes.Remove ("height");
122 Attributes ["height"] = value;
126 public override string InnerHtml {
127 get { throw new NotSupportedException (); }
128 set { throw new NotSupportedException (); }
131 public override string InnerText {
132 get { throw new NotSupportedException (); }
133 set { throw new NotSupportedException (); }
137 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
138 [WebSysDescription("")]
139 [WebCategory("Layout")]
140 public string VAlign {
142 string s = Attributes ["valign"];
143 return (s == null) ? String.Empty : s;
147 Attributes.Remove ("valign");
149 Attributes ["valign"] = value;
154 get { return (_cells == null) ? 0 : _cells.Count; }
158 protected override ControlCollection CreateControlCollection ()
160 return new HtmlTableCellControlCollection (this);
163 protected internal override void RenderChildren (HtmlTextWriter writer)
165 if (HasControls ()) {
167 base.RenderChildren (writer);
173 protected override void RenderEndTag (HtmlTextWriter writer)
177 writer.WriteEndTag (TagName);
178 if (writer.Indent == 0)
183 protected class HtmlTableCellControlCollection : ControlCollection {
185 internal HtmlTableCellControlCollection (HtmlTableRow owner)
190 public override void Add (Control child)
193 throw new NullReferenceException ("null");
194 if (!(child is HtmlTableCell))
195 throw new ArgumentException ("child", Locale.GetText ("Must be an HtmlTableCell instance."));
200 public override void AddAt (int index, Control child)
203 throw new NullReferenceException ("null");
204 if (!(child is HtmlTableCell))
205 throw new ArgumentException ("child", Locale.GetText ("Must be an HtmlTableCell instance."));
207 base.AddAt (index, child);