HtmlTableRow.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 HtmlYableCellControlCollection(this);
  14. }
  15. protected override void RenderChildren(HtmlTextWriter writer){
  16. writer.WriteLine();
  17. writer.Indent = writer.Indent + 1;
  18. base.RenderChildren;
  19. writer.Indent = writer.Indent - 1;
  20. }
  21. protected override 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 "";
  30. }
  31. set{
  32. Attributes["align"] = MapStringAttributeToString(value);
  33. }
  34. }
  35. public string BgColor {
  36. get{
  37. string attr = Attributes["bgcolor"];
  38. if (attr != null) return attr;
  39. return "";
  40. }
  41. set{
  42. Attributes["bgcolor"] = MapStringAttributeToString(value);
  43. }
  44. }
  45. public string BorderColor {
  46. get{
  47. string attr = Attributes["bordercolor"];
  48. if (attr != null) return attr;
  49. return "";
  50. }
  51. set{
  52. Attributes["bordercolor"] = MapStringAttributeToString(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 "";
  66. }
  67. set{
  68. Attributes["height"] = MapStringAttributeToString(value);
  69. }
  70. }
  71. public override string InnerHtml {
  72. get{
  73. throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
  74. }
  75. set{
  76. throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerHtml_Not_Supported", this.GetType.Name);
  77. }
  78. }
  79. public override string InnerText {
  80. get{
  81. throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
  82. }
  83. set{
  84. throw new NotSupportedException(HttpRuntime.FormatResourceString("InnerText_Not_Supported", this.GetType.Name);
  85. }
  86. }
  87. public string VAlign {
  88. get{
  89. string attr = Attributes["valign"];
  90. if (attr != null) return attr;
  91. return "";
  92. }
  93. set{
  94. Attributes["valign"] = MapStringAttributeToString(value);
  95. }
  96. }
  97. }
  98. private protected class HtmlTableCellControlCollection : ControlCollection {
  99. internal HtmlTableCellControlCollection(Control owner): base(owner);
  100. public override void Add(Control child){
  101. if (child Is HtmlTableCell){
  102. base.Add(child);
  103. }
  104. else{
  105. throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
  106. }
  107. }
  108. public override void AddAt(int index, Control child){
  109. if (child Is HtmlTableCell){
  110. base.AddAt(index,child);
  111. }
  112. else{
  113. throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTableRow",child.GetType.Name.ToString);
  114. }
  115. }
  116. } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
  117. // end of System.Web.UI.HtmlControls.HtmlTableRow
  118. }