CompareValidator.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. [ToolboxData("<{0}:CompareValidator runat=\"server\""
  18. + "ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
  19. public class CompareValidator: BaseCompareValidator
  20. {
  21. public CompareValidator()
  22. {
  23. // Intitalize();
  24. }
  25. public string ControlToCompare
  26. {
  27. get
  28. {
  29. object o = ViewState["ControlToCompare"];
  30. if(o!=null)
  31. return (string)o;
  32. return String.Empty;
  33. }
  34. set
  35. {
  36. ViewState["ControlToCompare"] = value;
  37. }
  38. }
  39. public ValidationCompareOperator Operator
  40. {
  41. get
  42. {
  43. object o = ViewState["Operator"];
  44. if(o!=null)
  45. return (ValidationCompareOperator)o;
  46. return ValidationCompareOperator.Equal;
  47. }
  48. set
  49. {
  50. if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
  51. throw new ArgumentException();
  52. ViewState["Operator"] = value;
  53. }
  54. }
  55. public string ValueToCompare
  56. {
  57. get
  58. {
  59. object o = ViewState["ValueToCompare"];
  60. if(o!=null)
  61. return (string)o;
  62. return String.Empty;
  63. }
  64. set
  65. {
  66. ViewState["ValueToCompare"] = value;
  67. }
  68. }
  69. [MonoTODO]
  70. protected override bool EvaluateIsValid()
  71. {
  72. string ctrl = GetControlValidationValue(ControlToValidate);
  73. throw new NotImplementedException();
  74. if(ctrl!=null && ctrl.Length > 0)
  75. {
  76. //string
  77. throw new NotImplementedException();
  78. }
  79. return true;
  80. }
  81. }
  82. }