(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Web / System.Web.UI.WebControls / CompareValidator.cs
blob0249103d9469f590bd3b8a37e37f4bc6dd6526f2
1 //
2 // System.Web.UI.WebControls.CompareValidator.cs
3 //
4 // Authors:
5 // Gaurav Vaish (gvaish@iitk.ac.in)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
7 //
8 // (C) Gaurav Vaish (2002)
9 // (C) 2003 Andreas Nahr
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System;
34 using System.Web;
35 using System.Web.UI;
36 using System.ComponentModel;
38 namespace System.Web.UI.WebControls
40 [ToolboxData("<{0}:CompareValidator runat=\"server\""
41 + "ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
42 public class CompareValidator: BaseCompareValidator
44 public CompareValidator()
46 // Intitalize();
49 [DefaultValue (""), WebCategory ("Behavior")]
50 [TypeConverter (typeof (ValidatedControlConverter))]
51 [WebSysDescription ("The ID of a control that is compared.")]
52 public string ControlToCompare
54 get
56 object o = ViewState["ControlToCompare"];
57 if(o!=null)
58 return (string)o;
59 return String.Empty;
62 set
64 ViewState["ControlToCompare"] = value;
68 [DefaultValue (typeof (ValidationCompareOperator), "Equal"), WebCategory ("Behavior")]
69 [WebSysDescription ("The operator that is used for comparison.")]
70 public ValidationCompareOperator Operator
72 get
74 object o = ViewState["Operator"];
75 if(o!=null)
76 return (ValidationCompareOperator)o;
77 return ValidationCompareOperator.Equal;
79 set
81 if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
82 throw new ArgumentException();
83 ViewState["Operator"] = value;
87 [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
88 [WebSysDescription ("The value that is compared to.")]
89 public string ValueToCompare
91 get
93 object o = ViewState["ValueToCompare"];
94 if(o!=null)
95 return (string)o;
96 return String.Empty;
98 set
100 ViewState["ValueToCompare"] = value;
104 protected override bool EvaluateIsValid ()
106 string ctrl = GetControlValidationValue (ControlToValidate);
107 if (ctrl == null || ctrl.Length == 0)
108 return true;
110 string cmp;
111 if (ControlToCompare.Length > 0) {
112 cmp = GetControlValidationValue (ControlToCompare);
113 } else {
114 cmp = ValueToCompare;
117 return Compare (ctrl, cmp, Operator, Type);
120 [MonoTODO]
121 protected override void AddAttributesToRender (HtmlTextWriter writer)
123 base.AddAttributesToRender (writer);
126 [MonoTODO]
127 protected override bool ControlPropertiesValid ()
129 return base.ControlPropertiesValid ();