HtmlControl.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // System.Web.UI.HtmlControls.HtmlControl.cs
  3. //
  4. // Author:
  5. // Bob Smith <[email protected]>
  6. //
  7. // (C) Bob Smith
  8. //
  9. using System;
  10. using System.Web;
  11. using System.Web.UI;
  12. namespace System.Web.UI.HtmlControls
  13. {
  14. public abstract class HtmlControl : Control, IAttributeAccessor
  15. {
  16. private string _tagName = "span";
  17. //TODO: Is this correct, or is the StateBag really the ViewState?
  18. private AttributeCollection _attributes = new AttributeCollection(new StateBag(true));
  19. private bool _disabled = false;
  20. public HtmlControl() {}
  21. public HtmlControl(string tag)
  22. {
  23. if(tag != null && tag != "") _tagName = tag;
  24. }
  25. public AttributeCollection Attributes
  26. {
  27. get
  28. {
  29. return _attributes;
  30. }
  31. }
  32. public bool Disabled
  33. {
  34. get
  35. {
  36. return _disabled;
  37. }
  38. set
  39. {
  40. _disabled = value;
  41. }
  42. }
  43. public CssStyleCollection Style
  44. {
  45. get
  46. {
  47. return _attributes.CssStyle;
  48. }
  49. }
  50. public virtual string TagName
  51. {
  52. get
  53. {
  54. return _tagName;
  55. }
  56. }
  57. }
  58. }