2
0

HtmlTableCell.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. using System.Globalization;
  9. namespace System.Web.UI.HtmlControls{
  10. public class HtmlTableCell : HtmlContainerControl {
  11. public HtmlTableCell(): base("td"){}
  12. public HtmlTableCell(string tagName): base(tagName){}
  13. protected override void RenderEndTag(HtmlTextWriter writer){
  14. base.RenderEndTag(writer);
  15. writer.WriteLine();
  16. }
  17. public string Align {
  18. get{
  19. string attr = Attributes["align"];
  20. if (attr != null) return attr;
  21. return String.Empty;
  22. }
  23. set{
  24. Attributes["align"] = AttributeToString(value);
  25. }
  26. }
  27. public string BgColor {
  28. get{
  29. string attr = Attributes["bgcolor"];
  30. if (attr != null) return attr;
  31. return String.Empty;
  32. }
  33. set{
  34. Attributes["bgcolor"] = AttributeToString(value);
  35. }
  36. }
  37. public string BorderColor {
  38. get{
  39. string attr = Attributes["bordercolor"];
  40. if (attr != null) return attr;
  41. return String.Empty;
  42. }
  43. set{
  44. Attributes["bordercolor"] = AttributeToString(value);
  45. }
  46. }
  47. public int ColSpan {
  48. get{
  49. string attr = Attributes["colspan"];
  50. if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
  51. return -1;
  52. }
  53. set{
  54. Attributes["colspan"] = AttributeToString(value);
  55. }
  56. }
  57. public string Height {
  58. get{
  59. string attr = Attributes["height"];
  60. if (attr != null) return attr;
  61. return String.Empty;
  62. }
  63. set{
  64. Attributes["height"] = AttributeToString(value);
  65. }
  66. }
  67. public bool NoWrap {
  68. get{
  69. string attr = Attributes["colspan"];
  70. if (attr != null) return attr.Equals("nowrap");
  71. return false;
  72. }
  73. set{
  74. if (value == true){
  75. Attributes["nowrap"] = "nowrap";
  76. }
  77. else{
  78. Attributes["nowrap"] = null;
  79. }
  80. }
  81. }
  82. public int RowSpan {
  83. get{
  84. string attr = Attributes["rowspan"];
  85. if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
  86. return -1;
  87. }
  88. set{
  89. Attributes["rowspan"] = AttributeToString(value);
  90. }
  91. }
  92. public string VAlign {
  93. get{
  94. string attr = Attributes["valign"];
  95. if (attr != null) return attr;
  96. return String.Empty;
  97. }
  98. set{
  99. Attributes["valign"] = AttributeToString(value);
  100. }
  101. }
  102. public string Width {
  103. get{
  104. string attr = Attributes["width"];
  105. if (attr != null) return attr;
  106. return String.Empty;
  107. }
  108. set{
  109. Attributes["width"] = AttributeToString(value);
  110. }
  111. }
  112. }
  113. // System.Web.UI.HtmlControls.HtmlTableCell
  114. }