From 552f78515b7dc4533687b41bff178d9e26a0bf08 Mon Sep 17 00:00:00 2001 From: Gonzalo Paniagua Javier Date: Wed, 1 Sep 2004 20:03:02 +0000 Subject: 2004-09-01 Gonzalo Paniagua Javier * LiteralControl.cs: stylized. This control has EnableViewState disabled by default and doesn't get an automatic ID. When text is null -> "". svn path=/branches/mono-1-0/mcs/; revision=33180 --- .../System.Web/System.Web.UI/LiteralControl.cs | 96 +++++++++++----------- 1 file changed, 50 insertions(+), 46 deletions(-) (limited to 'mcs/class/System.Web/System.Web.UI/LiteralControl.cs') 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 -// -// (C) Bob Smith -// +// +// System.Web.UI.LiteralControl.cs +// +// Author: +// Bob Smith +// 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); + } + } +} + -- cgit v1.2.3