Merge pull request #2448 from BrzVlad/feature-cprop-opt
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / ButtonFieldBase.cs
index efbdef1fc728f23e088b33d7289b782b9730b662..9db4f389feafa79943b374004fa08b7a183c5a35 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //     Lluis Sanchez Gual (lluis@novell.com)
 //
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
 //
 
 //
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System.Collections;
 using System.Collections.Specialized;
 using System.Web.UI;
 using System.ComponentModel;
 using System.Security.Permissions;
 
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
        [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public abstract class ButtonFieldBase : DataControlField
@@ -45,11 +44,7 @@ namespace System.Web.UI.WebControls {
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Appearance")]
                public virtual ButtonType ButtonType {
-                       get {
-                               object ob = ViewState ["ButtonType"];
-                               if (ob != null) return (ButtonType) ob;
-                               return ButtonType.Link;
-                       }
+                       get { return (ButtonType) ViewState.GetInt ("ButtonType", (int) ButtonType.Link); }
                        set {
                                ViewState ["ButtonType"] = value;
                                OnFieldChanged ();
@@ -60,11 +55,7 @@ namespace System.Web.UI.WebControls {
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Behavior")]
                public virtual bool CausesValidation {
-                       get {
-                               object ob = ViewState ["CausesValidation"];
-                               if (ob != null) return (bool) ob;
-                               return false;
-                       }
+                       get { return ViewState.GetBool ("CausesValidation", false); }
                        set {
                                ViewState ["CausesValidation"] = value;
                                OnFieldChanged ();
@@ -75,10 +66,7 @@ namespace System.Web.UI.WebControls {
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Behavior")]
                public override bool ShowHeader {
-                       get {
-                               object val = ViewState ["showHeader"];
-                               return val != null ? (bool) val : false;
-                       }
+                       get { return ViewState.GetBool ("showHeader", false); }
                        set { 
                                ViewState ["showHeader"] = value;
                                OnFieldChanged ();
@@ -89,11 +77,7 @@ namespace System.Web.UI.WebControls {
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Behavior")]
                public virtual string ValidationGroup {
-                       get {
-                               object ob = ViewState ["ValidationGroup"];
-                               if (ob != null) return (string) ob;
-                               return "";
-                       }
+                       get { return ViewState.GetString ("ValidationGroup", String.Empty); }
                        set {
                                ViewState ["ValidationGroup"] = value;
                                OnFieldChanged ();
@@ -111,4 +95,3 @@ namespace System.Web.UI.WebControls {
                }
        }
 }
-#endif