diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI/LiteralControl.cs')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/LiteralControl.cs | 96 |
1 files changed, 50 insertions, 46 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs index 9d469ee5f10..93002f71467 100644 --- a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs +++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs @@ -1,11 +1,13 @@ -//
-// System.Web.UI.LiteralControl.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
+// +// System.Web.UI.LiteralControl.cs +// +// Author: +// Bob Smith <bob@thestuff.net> +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) Bob Smith +// Copyright (c) 2002-2004 Novell, Inc. (http://www.novell.com) +// // // Permission is hereby granted, free of charge, to any person obtaining @@ -27,41 +29,43 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -
-using System;
-using System.ComponentModel;
-using System.Web;
-
-namespace System.Web.UI
-{
- [ToolboxItem(false)]
- public class LiteralControl : Control
- {
- private string _text = String.Empty;
- public LiteralControl() {}
- public LiteralControl(string text)
- {
- _text = text;
- }
- public virtual string Text
- {
- get
- {
- return _text;
- }
- set
- {
- _text = value;
- }
- }
- protected override void Render(HtmlTextWriter writer)
- {
- writer.Write(_text);
- }
-
- protected override ControlCollection CreateControlCollection ()
- {
- return new EmptyControlCollection (this);
- }
- }
-}
+ +using System; +using System.ComponentModel; +using System.Web; + +namespace System.Web.UI +{ + [ToolboxItem(false)] + public class LiteralControl : Control + { + string _text; + + public LiteralControl () : this (null) {} + + public LiteralControl (string text) + { + EnableViewState = false; + PreventAutoID (); + _text = (text == null) ? "" : text; // Text property is not called for this. + } + + public virtual string Text { + get { return _text; } + set { + _text = (value == null) ? "" : value; + } + } + + protected override void Render (HtmlTextWriter writer) + { + writer.Write (_text); + } + + protected override ControlCollection CreateControlCollection () + { + return new EmptyControlCollection (this); + } + } +} + |