private void gridViewTaiKhoan_ValidateRow(object sender, ValidateRowEventArgs e) { TaiKhoan objTaiKhoan = e.Row as TaiKhoan; if (objTaiKhoan != null) { objTaiKhoan.AddValidationRuleHandler(RuleCheckDuplicate, "TenDangNhap"); if (objTaiKhoan.IsValid) { e.Valid = true; } else { XtraMessageBox.Show(objTaiKhoan.Error, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Valid = false; } } }