2
0

HtmlTableRow.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* System.Web.UI.HtmlControls
  2. * Authors
  3. * Leen Toelen ([email protected])
  4. */
  5. using System;
  6. using System.Web;
  7. using System.Web.UI;
  8. namespace System.Web.UI.HtmlControls{
  9. public class HtmlTableRow : HtmlContainerControl {
  10. private HtmlTableCellCollection _cells;
  11. public HtmlTableRow():base("tr"){}
  12. protected override ControlCollection CreateControlCollection(){
  13. return new HtmlTableCellControlCollection(this);
  14. }
  15. protected override void RenderChildren(HtmlTextWriter writer){
  16. writer.WriteLine();
  17. writer.Indent = writer.Indent + 1;
  18. this.RenderChildren(writer);
  19. writer.Indent = writer.Indent - 1;
  20. }
  21. protected new void RenderEndTag(HtmlTextWriter writer){
  22. base.RenderEndTag(writer);
  23. writer.WriteLine();
  24. }
  25. public string Align {
  26. get{
  27. string attr = Attributes["align"];
  28. if (attr != null) return attr;
  29. return String.Empty;
  30. }
  31. set{
  32. Attributes["align"] = AttributeToString(value);
  33. }
  34. }
  35. public string BgColor {
  36. get{
  37. string attr = Attributes["bgcolor"];
  38. if (attr != null) return attr;
  39. return String.Empty;
  40. }
  41. set{
  42. Attributes["bgcolor"] = AttributeToString(value);
  43. }
  44. }
  45. public string BorderColor {
  46. get{
  47. string attr = Attributes["bordercolor"];
  48. if (attr != null) return attr;
  49. return String.Empty;
  50. }
  51. set{
  52. Attributes["bordercolor"] = AttributeToString(value);
  53. }
  54. }
  55. public virtual HtmlTableCellCollection Cells {
  56. get{
  57. if (_cells == null) _cells = new HtmlTableCellCollection(this);
  58. return _cells;
  59. }
  60. }
  61. public string Height {
  62. get{
  63. string attr = Attributes["height"];
  64. if (attr != null) return attr;
  65. return String.Empty;
  66. }
  67. set{
  68. Attributes["height"] = AttributeToString(value);
  69. }
  70. }
  71. public override string InnerHtml {
  72. get{
  73. throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
  74. }
  75. set{
  76. throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
  77. }
  78. }
  79. public override string InnerText {
  80. get{
  81. throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
  82. }
  83. set{
  84. throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
  85. }
  86. }
  87. public string VAlign {
  88. get{
  89. string attr = Attributes["valign"];
  90. if (attr != null) return attr;
  91. return String.Empty;
  92. }
  93. set{
  94. Attributes["valign"] = AttributeToString(value);
  95. }
  96. }
  97. protected class HtmlTableCellControlCollection : ControlCollection {
  98. internal HtmlTableCellControlCollection(Control owner): base(owner){}
  99. public override void Add(Control child){
  100. if (child is HtmlTableCell){
  101. base.Add(child);
  102. }
  103. else{
  104. throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
  105. }
  106. }
  107. public override void AddAt(int index, Control child){
  108. if (child is HtmlTableCell){
  109. base.AddAt(index,child);
  110. }
  111. else{
  112. throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
  113. }
  114. }
  115. }
  116. } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
  117. // end of System.Web.UI.HtmlControls.HtmlTableRow
  118. }