diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-06-12 16:10:40 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-06-12 16:10:40 +0400 |
commit | 1c20689cf8811e84dbdf248448532c314908dd68 (patch) | |
tree | e7f5a07f429d7151970a4162d92c0285220a0771 | |
parent | fc5fb587b11bd13fc113215af624e941fba6d67c (diff) |
2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Label.cs: beautified and fixed a couple of 'classic' bugs.
* WebControl.cs: use Span as default tag when no other provided in
constructor. That is what MS renders.
svn path=/trunk/mcs/; revision=5249
3 files changed, 35 insertions, 39 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index ea0914de748..97bc44a3e49 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -1,5 +1,12 @@ 2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + * Label.cs: beautified and fixed a couple of 'classic' bugs. + + * WebControl.cs: use Span as default tag when no other provided in + constructor. That is what MS renders. + +2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + * Button.cs: (AddAttributesToRender): fixed (classic) stack overflow. diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs index 752b77f7b4b..46d64521f47 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs @@ -26,69 +26,60 @@ namespace System.Web.UI.WebControls [ToolboxData("<{0}:Label runat=\"server\">Label</{0}:Label>")]
public class Label : WebControl
{
- public Label(): base()
+ public Label (): base ()
{
}
- internal Label(HtmlTextWriterTag tagKey): base(tagKey)
+ internal Label (HtmlTextWriterTag tagKey) : base (tagKey)
{
}
public virtual string Text
{
- get
- {
- object o = ViewState["Text"];
- if(o!=null)
- return (string)o;
- return String.Empty;
- }
- set
- {
- ViewState["Text"] = value;
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
}
+
+ set { ViewState ["Text"] = value; }
}
- protected override void AddParsedSubObject(object obj)
+ protected override void AddParsedSubObject (object obj)
{
- if(HasControls())
- {
- AddParsedSubObject(obj);
+ if(HasControls ()){
+ base.AddParsedSubObject (obj);
return;
}
- if(obj is LiteralControl)
- {
- Text = ((LiteralControl)obj).Text;
+
+ if(obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
return;
}
- if(Text.Length > 0)
- {
- AddParsedSubObject(Text);
+
+ if(Text.Length > 0){
+ base.AddParsedSubObject (new LiteralControl (Text));
Text = String.Empty;
}
- AddParsedSubObject(obj);
+
+ base.AddParsedSubObject (obj);
}
- protected override void LoadViewState(object savedState)
+ protected override void LoadViewState (object savedState)
{
- if(savedState != null)
- {
- base.LoadViewState(savedState);
- string savedText = (string)ViewState["Text"];
+ if(savedState != null) {
+ base.LoadViewState (savedState);
+ string savedText = ViewState ["Text"] as string;
if(savedText != null)
Text = savedText;
}
}
- protected override void RenderContents(HtmlTextWriter writer)
+ protected override void RenderContents (HtmlTextWriter writer)
{
- if(HasControls())
- {
- RenderContents(writer);
- } else
- {
- writer.Write(Text);
- }
+ if(HasControls ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
}
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs index 30c52c3a479..92bd4572e17 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs @@ -35,10 +35,8 @@ namespace System.Web.UI.WebControls private string tagName;
// TODO: The constructors definitions
- protected WebControl(): base()
+ protected WebControl () : this (HtmlTextWriterTag.Span)
{
- //todo: what now? To be rendered as SPAN tag!
- Initialize();
}
public WebControl(HtmlTextWriterTag tag): base()
|