HtmlTableCell.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. //
  2. // System.Web.UI.HtmlControls.HtmlTableRow.cs
  3. //
  4. // Author:
  5. // Sebastien Pouliot <[email protected]>
  6. //
  7. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  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:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  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.
  27. //
  28. using System.ComponentModel;
  29. using System.Globalization;
  30. namespace System.Web.UI.HtmlControls {
  31. [ConstructorNeedsTag (true)]
  32. public class HtmlTableCell : HtmlContainerControl {
  33. public HtmlTableCell ()
  34. : base ("td")
  35. {
  36. }
  37. public HtmlTableCell (string tagName)
  38. : base (tagName)
  39. {
  40. }
  41. [DefaultValue ("")]
  42. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  43. public string Align {
  44. get {
  45. string s = Attributes ["align"];
  46. return (s == null) ? String.Empty : s;
  47. }
  48. set {
  49. if (value == null)
  50. Attributes.Remove ("align");
  51. else
  52. Attributes ["align"] = value;
  53. }
  54. }
  55. [DefaultValue ("")]
  56. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  57. public string BgColor {
  58. get {
  59. string s = Attributes ["bgcolor"];
  60. return (s == null) ? String.Empty : s;
  61. }
  62. set {
  63. if (value == null)
  64. Attributes.Remove ("bgcolor");
  65. else
  66. Attributes ["bgcolor"] = value;
  67. }
  68. }
  69. [DefaultValue ("")]
  70. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  71. public string BorderColor {
  72. get {
  73. string s = Attributes ["bordercolor"];
  74. return (s == null) ? String.Empty : s;
  75. }
  76. set {
  77. if (value == null)
  78. Attributes.Remove ("bordercolor");
  79. else
  80. Attributes ["bordercolor"] = value;
  81. }
  82. }
  83. [DefaultValue ("")]
  84. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  85. public int ColSpan {
  86. get {
  87. string s = Attributes ["colspan"];
  88. return (s == null) ? -1 : Convert.ToInt32 (s);
  89. }
  90. set {
  91. if (value == -1)
  92. Attributes.Remove ("colspan");
  93. else
  94. Attributes ["colspan"] = value.ToString (CultureInfo.InvariantCulture);
  95. }
  96. }
  97. [DefaultValue ("")]
  98. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  99. public string Height {
  100. get {
  101. string s = Attributes ["height"];
  102. return (s == null) ? String.Empty : s;
  103. }
  104. set {
  105. if (value == null)
  106. Attributes.Remove ("align");
  107. else
  108. Attributes ["height"] = value;
  109. }
  110. }
  111. [DefaultValue ("")]
  112. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  113. #if NET_2_0
  114. [MonoTODO ("duplicate internal class for TypeConverter ?")]
  115. [TypeConverter ("System.Web.UI.MinimizableAttributeTypeConverter, " + Consts.AssemblySystem_Web)]
  116. #endif
  117. public bool NoWrap {
  118. get { return (Attributes ["nowrap"] == "nowrap"); }
  119. set {
  120. if (value)
  121. Attributes ["nowrap"] = "nowrap";
  122. else
  123. Attributes.Remove ("nowrap");
  124. }
  125. }
  126. [DefaultValue ("")]
  127. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  128. public int RowSpan {
  129. get {
  130. string s = Attributes ["rowspan"];
  131. return (s == null) ? -1 : Convert.ToInt32 (s);
  132. }
  133. set {
  134. if (value == -1)
  135. Attributes.Remove ("rowspan");
  136. else
  137. Attributes ["rowspan"] = value.ToString (CultureInfo.InvariantCulture);
  138. }
  139. }
  140. [DefaultValue ("")]
  141. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  142. public string VAlign {
  143. get {
  144. string s = Attributes ["valign"];
  145. return (s == null) ? String.Empty : s;
  146. }
  147. set {
  148. if (value == null)
  149. Attributes.Remove ("valign");
  150. else
  151. Attributes ["valign"] = value;
  152. }
  153. }
  154. [DefaultValue ("")]
  155. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  156. public string Width {
  157. get {
  158. string s = Attributes ["width"];
  159. return (s == null) ? String.Empty : s;
  160. }
  161. set {
  162. if (value == null)
  163. Attributes.Remove ("width");
  164. else
  165. Attributes ["width"] = value;
  166. }
  167. }
  168. protected override void RenderEndTag (HtmlTextWriter writer)
  169. {
  170. writer.WriteEndTag (TagName);
  171. if (writer.Indent == 0)
  172. writer.WriteLine ();
  173. }
  174. }
  175. }