0
     public string InsuredName
              {
                  get;
                  set;
              }
  public string Card_No
          {
              get { return this.card_No; }
              set { this.card_No = value; }
          }

在这里我有两个属性, CardNo只有一些需要InsuredNames。当用户键入 InsuredName 然后我想去数据库并检查它是否有 Card_No 验证如果是,那么我想根据需要验证它,否则,我尝试了远程验证但是它不工作

4

1 回答 1

0
private string insuredName;
  private bool cardNoRequiresValidation;
  public string InsuredName
              {
                  get {return insuredName;}
                  set { cardNoRequiresValidation = DoesCardNoRequiresValidation(Value); insuredName = value;}
              }
  public string Card_No
          {
              get { return this.card_No; }
              set { cardNoRequiresValidation ? ValidateCardNo(value) : card_No =  value; }
          }
  private bool DoesCardNoRequiresValidation(string insuredName)
  { //if requires validation 
    // return true;
    //else 
    //return false;
  }
  private void ValidateCardNo(string cardNo)
  {
    //execute validation logic
  }
于 2012-10-24T06:22:38.473 回答