/// <summary> /// 判断会员名是否已存在 /// </summary> /// <param name="source"></param> /// <param name="args"></param> protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { B_User bll = new B_User(); string userName = this.tbUserName.Text; if (bll.IsExit(userName)) { args.IsValid = false; this.CustomValidator1.Visible = true; this.tbUserName.Text = ""; } else { args.IsValid = true; } }