모달 대화 상자에 내 ValidationSummary가 표시됩니다. 그것은 잘 작동합니다.모달 대화 상자에 CustomValidator 표시
그러나 내 코드 숨김은 일부 데이터베이스 조회를 수행하고 CustomValidator가있는 메시지를 내 ValidationSummary에 추가합니다.
대화 상자에 내 ValidationSummary가 표시되기 전에 제대로 작동했습니다. 그러나 이제 CustomValidator가 유효하지 않은 경우 ValidationSummary 대화 상자에 표시되지 않습니다.
다른 필드가 유효하지 않을 때 대화 상자가 나타나지만 코드 숨김의 CustomValidator 메시지에는 유효하지 않습니다. 페이지가 유효하지 않은 경우 다음
대화 상자를 표시하는 코드입니다 :<script type="text/javascript">
function WebForm_OnSubmit() {
if (typeof (ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) {
$("#modal_validationSummary").modal('show');
return false;
}
return true;
}
</script>
검증 요약 코드 :
<div class="modal modal-danger" id="modal_validationSummary" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Invalid Login</h4>
</div>
<div class="modal-body clearfix">
<asp:ValidationSummary ID="LoginValidationSummary" runat="server"
ValidationGroup="LoginGroup" HeaderText="<div class='validationheader'>Please address the issues below</div>"
CssClass="validationsummary" DisplayMode="BulletList"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-clean" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
내 코드 뒤에 직접 CustomValidator 추가 :
CustomValidator cv = new CustomValidator();
cv.IsValid = false;
cv.ErrorMessage = "Login not found. Please try again.";
cv.ValidationGroup = "LoginGroup";
this.Page.Validators.Add(cv);
을
도움 주셔서 감사합니다.
도움을 주셔서 감사합니다. 나는 정보가 매우 도움이되도록이 새로운 것을. – Cineno28