CompareValidator.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: CompareValidator
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Implementation: yes
  8. * Status: 80%
  9. *
  10. * (C) Gaurav Vaish (2001)
  11. */
  12. using System;
  13. using System.Web;
  14. using System.Web.UI;
  15. namespace System.Web.UI.WebControls
  16. {
  17. public class CompareValidator: BaseCompareValidator
  18. {
  19. public CompareValidator()
  20. {
  21. // Intitalize();
  22. }
  23. public string ControlToCompare
  24. {
  25. get
  26. {
  27. object o = ViewState["ControlToCompare"];
  28. if(o!=null)
  29. return (string)o;
  30. return String.Empty;
  31. }
  32. set
  33. {
  34. ViewState["ControlToCompare"] = value;
  35. }
  36. }
  37. public ValidationCompareOperator Operator
  38. {
  39. get
  40. {
  41. object o = ViewState["Operator"];
  42. if(o!=null)
  43. return (ValidationCompareOperator)o;
  44. return ValidationCompareOperator.Equal;
  45. }
  46. set
  47. {
  48. if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
  49. throw new ArgumentException();
  50. ViewState["Operator"] = value;
  51. }
  52. }
  53. public string ValueToCompare
  54. {
  55. get
  56. {
  57. object o = ViewState["ValueToCompare"];
  58. if(o!=null)
  59. return (string)o;
  60. return String.Empty;
  61. }
  62. set
  63. {
  64. ViewState["ValueToCompare"] = value;
  65. }
  66. }
  67. [MonoTODO]
  68. protected override bool EvaluateIsValid()
  69. {
  70. string ctrl = GetControlValidationValue(ControlToValidate);
  71. throw new NotImplementedException();
  72. if(ctrl!=null && ctrl.Length > 0)
  73. {
  74. //string
  75. return false;
  76. }
  77. return true;
  78. }
  79. }
  80. }