diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs index f95bc8f9f28..57a0a9aa588 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs @@ -180,7 +180,15 @@ namespace System.Web.UI.WebControls { [WebCategory ("Appearance")] public virtual TextAlign TextAlign { - get { return (TextAlign) ViewState.GetInt ("TextAlign", (int)TextAlign.Right); } + get { + object o = ViewState["TextAlign"]; + + if (o == null) { + return (TextAlign.Right); + } else { + return ((TextAlign)o); + } + } set { if (value != TextAlign.Left && value != TextAlign.Right) { @@ -196,7 +204,7 @@ namespace System.Web.UI.WebControls { [DefaultValue ("")] [WebSysDescription ("")] [WebCategoryAttribute ("Behavior")] - public virtual string ValidationGroup + public string ValidationGroup { get { return ViewState.GetString ("ValidationGroup", String.Empty); } set { ViewState["ValidationGroup"] = value; } @@ -312,13 +320,13 @@ namespace System.Web.UI.WebControls { if (Page != null) Page.VerifyRenderingInServerForm (this); - bool need_span = ControlStyleCreated && !ControlStyle.IsEmpty; + bool need_span = ControlStyleCreated; if (need_span) ControlStyle.AddAttributesToRender (w, this); if (!Enabled) { w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled"); - need_span = true; + //need_span = true; } string tt = ToolTip; @@ -346,7 +354,7 @@ namespace System.Web.UI.WebControls { if (AutoPostBack){ w.AddAttribute (HtmlTextWriterAttribute.Onclick, - Page.ClientScript.GetPostBackEventReference (this, String.Empty)); + Page.ClientScript.GetPostBackClientEvent (this, String.Empty)); w.AddAttribute ("language", "javascript"); } @@ -383,6 +391,9 @@ namespace System.Web.UI.WebControls { w.RenderEndTag (); } + if (!Enabled) + w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled"); + w.AddAttribute (HtmlTextWriterAttribute.Id, ClientID); w.AddAttribute (HtmlTextWriterAttribute.Type, render_type); w.AddAttribute (HtmlTextWriterAttribute.Name, NameAttribute); @@ -392,7 +403,7 @@ namespace System.Web.UI.WebControls { if (AutoPostBack){ w.AddAttribute (HtmlTextWriterAttribute.Onclick, - Page.ClientScript.GetPostBackEventReference (this, String.Empty)); + Page.ClientScript.GetPostBackClientEvent (this, String.Empty)); w.AddAttribute ("language", "javascript"); } @@ -459,8 +470,6 @@ namespace System.Web.UI.WebControls { internal virtual void InternalAddAttributesToRender (HtmlTextWriter w) { - if (!Enabled) - w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled"); } } } |