diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-09-02 00:03:02 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-09-02 00:03:02 +0400 |
commit | 552f78515b7dc4533687b41bff178d9e26a0bf08 (patch) | |
tree | 6e95c0366112114a32c0601c9c6b2d910bf1dc75 /mcs/class/System.Web | |
parent | a0ea59a1e1c35eb6ff8522e6bc090345acacd0ec (diff) |
2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* 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
Diffstat (limited to 'mcs/class/System.Web')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/LiteralControl.cs | 96 |
2 files changed, 55 insertions, 46 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index dd08b76969d..9a598b724df 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,8 @@ +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * LiteralControl.cs: stylized. This control has EnableViewState disabled + by default and doesn't get an automatic ID. When text is null -> "". + 2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControl.cs: don't include private methods of base classes when 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); + } + } +} + |