2
0

CompareValidator.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. protected override bool EvaluateIsValid()
  68. {
  69. string ctrl = GetControlValidationValue(ControlToValidate);
  70. throw new NotImplementedException();
  71. if(ctrl!=null && ctrl.Length > 0)
  72. {
  73. //string
  74. return false;
  75. }
  76. return true;
  77. }
  78. }
  79. }