2 // System.Web.UI.WebControls.TableRow.cs
5 // Gaurav Vaish (gvaish@iitk.ac.in)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 // (C) Gaurav Vaish (2002)
9 // (C) 2003 Andreas Nahr
13 using System.ComponentModel;
\r
15 using System.Web.UI;
\r
17 namespace System.Web.UI.WebControls
\r
19 [DefaultProperty("Cells")]
\r
20 [ParseChildren(true, "Cells")]
21 [ToolboxItem (false)]
\r
22 public class TableRow: WebControl
\r
24 private TableCellCollection cells;
\r
26 public TableRow() : base (HtmlTextWriterTag.Tr)
\r
31 [MergableProperty (false), PersistenceMode (PersistenceMode.InnerDefaultProperty)]
32 [WebSysDescription ("All cells that exist in a table row.")]
\r
33 public virtual TableCellCollection Cells
\r
37 cells = new TableCellCollection (this);
\r
42 [DefaultValue (typeof (HorizontalAlign), "NotSet"), Bindable (true), WebCategory ("Layout")]
43 [WebSysDescription ("The horizontal alignment for all table cells in that row.")]
\r
44 public virtual HorizontalAlign HorizontalAlign
\r
47 if (!ControlStyleCreated)
\r
48 return HorizontalAlign.NotSet;
\r
49 return ((TableItemStyle)ControlStyle).HorizontalAlign;
\r
52 set { ((TableItemStyle)ControlStyle).HorizontalAlign = value; }
\r
55 [DefaultValue (typeof (VerticalAlign), "NotSet"), Bindable (true), WebCategory ("Layout")]
56 [WebSysDescription ("The verical alignment for all table cells in that row.")]
\r
57 public virtual VerticalAlign VerticalAlign
\r
60 if (!ControlStyleCreated)
\r
61 return VerticalAlign.NotSet;
\r
62 return ((TableItemStyle)ControlStyle).VerticalAlign;
\r
65 set { ((TableItemStyle)ControlStyle).VerticalAlign = value; }
\r
68 protected override Style CreateControlStyle ()
\r
70 return new TableItemStyle (ViewState);
\r
73 protected override ControlCollection CreateControlCollection ()
\r
75 return new CellControlCollection (this);
\r
78 protected class CellControlCollection : ControlCollection
\r
80 internal CellControlCollection (Control owner) : base (owner)
\r
84 public override void Add (Control child)
\r
86 if (!(child is TableCell))
\r
87 throw new ArgumentException (HttpRuntime.FormatResourceString (
\r
88 "Cannot_Have_Children_Of_Type",
\r
90 GetType ().Name.ToString ()));
\r
94 public override void AddAt(int index, Control child)
\r
96 if (!(child is TableCell))
\r
97 throw new ArgumentException (HttpRuntime.FormatResourceString (
\r
98 "Cannot_Have_Children_Of_Type",
\r
100 GetType ().Name.ToString ()));
\r
101 base.AddAt (index, child);
\r