HtmlMeta.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // System.Web.UI.HtmlControls.HtmlHead
  3. //
  4. // Authors:
  5. // Chris Toshok ([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. #if NET_2_0
  29. using System.ComponentModel;
  30. using System.Collections;
  31. using System.Security.Permissions;
  32. using System.Web.UI.WebControls;
  33. namespace System.Web.UI.HtmlControls
  34. {
  35. [ControlBuilder (typeof (HtmlEmptyTagControlBuilder))]
  36. public class HtmlMeta: HtmlControl
  37. {
  38. public HtmlMeta () : base ("meta")
  39. {
  40. }
  41. [DefaultValue ("")]
  42. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  43. public virtual string Content {
  44. get {
  45. string s = Attributes["content"];
  46. if (s == null)
  47. return "";
  48. return s;
  49. }
  50. set {
  51. if (value == null)
  52. Attributes.Remove ("content");
  53. else
  54. Attributes["content"] = value;
  55. }
  56. }
  57. [DefaultValue ("")]
  58. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  59. public virtual string HttpEquiv {
  60. get {
  61. string s = Attributes["http-equiv"];
  62. if (s == null)
  63. return "";
  64. return s;
  65. }
  66. set {
  67. if (value == null)
  68. Attributes.Remove ("http-equiv");
  69. else
  70. Attributes["http-equiv"] = value;
  71. }
  72. }
  73. [DefaultValue ("")]
  74. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  75. public virtual string Name {
  76. get {
  77. string s = Attributes["name"];
  78. if (s == null)
  79. return "";
  80. return s;
  81. }
  82. set {
  83. if (value == null)
  84. Attributes.Remove ("name");
  85. else
  86. Attributes["name"] = value;
  87. }
  88. }
  89. [DefaultValue ("")]
  90. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  91. public virtual string Scheme {
  92. get {
  93. string s = Attributes["scheme"];
  94. if (s == null)
  95. return "";
  96. return s;
  97. }
  98. set {
  99. if (value == null)
  100. Attributes.Remove ("scheme");
  101. else
  102. Attributes["scheme"] = value;
  103. }
  104. }
  105. protected internal override void Render (HtmlTextWriter writer)
  106. {
  107. writer.WriteBeginTag (TagName);
  108. RenderAttributes (writer);
  109. writer.Write (">");
  110. }
  111. }
  112. }
  113. #endif