DesignerDataBoundLiteralControl.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // System.Web.UI.DesignerDataBoundLiteralControl.cs
  3. //
  4. // Author:
  5. // Andreas Nahr ([email protected])
  6. //
  7. // (C) 2003 Andreas Nahr
  8. //
  9. using System;
  10. using System.ComponentModel;
  11. namespace System.Web.UI
  12. {
  13. [ToolboxItem(false)]
  14. [DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
  15. public sealed class DesignerDataBoundLiteralControl : Control
  16. {
  17. private string text = "";
  18. public DesignerDataBoundLiteralControl ()
  19. {
  20. base.PreventAutoID ();
  21. }
  22. public string Text {
  23. get { return text;}
  24. set {
  25. if (value == null)
  26. text = string.Empty;
  27. else
  28. text = value;
  29. }
  30. }
  31. protected override ControlCollection CreateControlCollection ()
  32. {
  33. return new EmptyControlCollection (this);
  34. }
  35. protected override void LoadViewState (object savedState)
  36. {
  37. if (savedState != null)
  38. text = (string) savedState;
  39. }
  40. protected override void Render (HtmlTextWriter output)
  41. {
  42. output.Write (text);
  43. }
  44. protected override object SaveViewState ()
  45. {
  46. return text;
  47. }
  48. }
  49. }