X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Web%2FSystem.Web.UI.HtmlControls%2FHtmlContainerControl.cs;h=66d1881d64104da93c1c90871c6d34618689e9fb;hb=2d23bfcbce7a3f7e54dcd5911adb88b244baca35;hp=bfe41cfa39a86d09a6816488f9a25c9520297422;hpb=04d1b4116331e3813b8f75304f714a5d61ba1214;p=mono.git diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs index bfe41cfa39a..66d1881d641 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs @@ -7,7 +7,7 @@ // // (C) Bob Smith // (c) 2002 Ximian, Inc. (http://www.ximian.com) -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) +// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -55,16 +55,13 @@ namespace System.Web.UI.HtmlControls // CAS [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] - public abstract class HtmlContainerControl : HtmlControl { - -#if NET_2_0 - protected -#else - public -#endif - HtmlContainerControl () : this ("span") {} + public abstract class HtmlContainerControl : HtmlControl + { + protected HtmlContainerControl () : this ("span") + {} - public HtmlContainerControl (string tag) : base(tag) {} + public HtmlContainerControl (string tag) : base(tag) + {} [HtmlControlPersistable (false)] [BrowsableAttribute(false)] @@ -74,22 +71,19 @@ namespace System.Web.UI.HtmlControls get { if (Controls.Count == 0) return String.Empty; - - bool is_literal = true; - StringBuilder text = new StringBuilder (); - foreach (Control ctrl in Controls) { + + if (Controls.Count == 1) { + Control ctrl = Controls [0]; LiteralControl lc = ctrl as LiteralControl; - if (lc == null) { - is_literal = false; - break; - } - text.Append (lc.Text); - } - - if (!is_literal) - throw new HttpException ("There is no literal content!"); + if (lc != null) + return lc.Text; - return text.ToString (); + DataBoundLiteralControl dblc = ctrl as DataBoundLiteralControl; + if (dblc != null) + return dblc.Text; + } + + throw new HttpException ("There is no literal content!"); } set { @@ -116,12 +110,7 @@ namespace System.Web.UI.HtmlControls } } -#if NET_2_0 - protected internal -#else - protected -#endif - override void Render (HtmlTextWriter writer) + protected internal override void Render (HtmlTextWriter writer) { RenderBeginTag (writer); RenderChildren (writer);