refactoring: Button, ImageButton and LinkButton are used insted internal DataControlB...
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / CompareValidator.cs
index af1bcda88ae6340ecdcc6c57255c4a1cdc90613f..26d89229f540503857a02f16b9925a6b159d08ce 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Web;
-using System.Web.UI.WebControls;
 using System.Globalization;
 using System.ComponentModel;
+using System.Security.Permissions;
 
-namespace System.Web.UI.WebControls
-{
+namespace System.Web.UI.WebControls {
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
 #if NET_2_0
        [ToolboxData("<{0}:CompareValidator runat=\"server\" ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
 #else
@@ -67,7 +69,7 @@ namespace System.Web.UI.WebControls
                                return base.ControlPropertiesValid();
 
                        /* attempt to locate the ControlToCompare somewhere on the page */
-                       Control control = Page.FindControl (ControlToCompare);
+                       Control control = NamingContainer.FindControl (ControlToCompare);
                        if (control == null)
                                throw new HttpException (String.Format ("Unable to locate ControlToCompare with id `{0}'", ControlToCompare));
 
@@ -97,12 +99,8 @@ namespace System.Web.UI.WebControls
                [Themeable (false)]
 #endif
                public string ControlToCompare {
-                       get {
-                               return ViewState.GetString ("ControlToCompare", String.Empty);
-                       }
-                       set {
-                               ViewState["ControlToCompare"] = value;
-                       }
+                       get { return ViewState.GetString ("ControlToCompare", String.Empty); }
+                       set { ViewState["ControlToCompare"] = value; }
                }
 
                [DefaultValue(ValidationCompareOperator.Equal)]
@@ -112,13 +110,8 @@ namespace System.Web.UI.WebControls
                [Themeable (false)]
 #endif
                public ValidationCompareOperator Operator {
-                       get {
-                               return (ValidationCompareOperator)ViewState.GetInt ("Operator", (int)ValidationCompareOperator.Equal);
-                       }
-
-                       set {
-                               ViewState ["Operator"] = (int)value;
-                       }
+                       get { return (ValidationCompareOperator)ViewState.GetInt ("Operator", (int)ValidationCompareOperator.Equal); }
+                       set { ViewState ["Operator"] = (int)value; }
                }
 
 #if !NET_2_0
@@ -131,12 +124,8 @@ namespace System.Web.UI.WebControls
                [Themeable (false)]
 #endif
                public string ValueToCompare {
-                       get {
-                               return ViewState.GetString ("ValueToCompare", String.Empty);
-                       }
-                       set {
-                               ViewState ["ValueToCompare"] = value;
-                       }
+                       get { return ViewState.GetString ("ValueToCompare", String.Empty); }
+                       set { ViewState ["ValueToCompare"] = value; }
                }
        }
 }