00001 using System; 00002 using System.ComponentModel; 00003 using System.Drawing; 00004 using System.Web.UI; 00005 using ASP = System.Web.UI.WebControls; 00006 00007 namespace Anthem 00008 { 00012 [ToolboxBitmap(typeof(ASP.Label))] 00013 public class Label : ASP.Label, IUpdatableControl 00014 { 00015 #region Unique Anthem control code 00016 00017 private const string parentTagName = "span"; 00022 protected override void Render(HtmlTextWriter writer) 00023 { 00024 #if !V2 00025 bool DesignMode = this.Context == null; 00026 #endif 00027 if (!DesignMode) 00028 { 00029 Anthem.Manager.WriteBeginControlMarker(writer, parentTagName, this); 00030 } 00031 if (Visible) 00032 { 00033 base.Render(writer); 00034 } 00035 if (!DesignMode) 00036 { 00037 Anthem.Manager.WriteEndControlMarker(writer, parentTagName, this); 00038 } 00039 } 00040 00041 #endregion 00042 00043 #region IUpdatableControl implementation 00044 00058 [Category("Anthem")] 00059 [DefaultValue(false)] 00060 [Description("True if this control should be updated after each callback.")] 00061 public virtual bool AutoUpdateAfterCallBack 00062 { 00063 get 00064 { 00065 object obj = this.ViewState["AutoUpdateAfterCallBack"]; 00066 if (obj == null) 00067 return false; 00068 else 00069 return (bool)obj; 00070 } 00071 set 00072 { 00073 if (value) UpdateAfterCallBack = true; 00074 ViewState["AutoUpdateAfterCallBack"] = value; 00075 } 00076 } 00077 00078 private bool _updateAfterCallBack = false; 00079 00094 [Browsable(false)] 00095 [DefaultValue(false)] 00096 public virtual bool UpdateAfterCallBack 00097 { 00098 get { return _updateAfterCallBack; } 00099 set { _updateAfterCallBack = value; } 00100 } 00101 00102 #endregion 00103 00104 #region Common Anthem control code 00105 00111 protected override void OnLoad(EventArgs e) 00112 { 00113 base.OnLoad(e); 00114 Anthem.Manager.Register(this); 00115 } 00116 00117 #if V2 00121 public override void RenderControl(HtmlTextWriter writer) 00122 { 00123 base.Visible = true; 00124 base.RenderControl(writer); 00125 } 00126 #endif 00127 00135 public override bool Visible 00136 { 00137 get 00138 { 00139 #if !V2 00140 bool DesignMode = this.Context == null; 00141 #endif 00142 return Anthem.Manager.GetControlVisible(this, ViewState, DesignMode); 00143 } 00144 set { Anthem.Manager.SetControlVisible(ViewState, value); } 00145 } 00146 00147 #endregion 00148 } 00149 }