일(job)/MS(Microsoft)
[ASP.NET] CustomValidator, ErrorMessage 속성 관리
뽀&쏭
2015. 12. 11. 13:23
xxx.aspx (server control)
<asp:CustomValidator id="vrfAll" runat="server" ControlToValidate="xmlSEGTYPE" ErrorMessage="MSG_CO_VALID_REQ_01" ClientValidationFunction="segTypeAll" Display="Dynamic"></asp:CustomValidator>
xxx.aspx (javascript)
function segTypeAll(source, arguments) {
var txt = arguments.Value;
// more than two?
var msg = '<%= this.getMessageName("MSG_CO_VALID_REQ_01") %>';
if (txt == '전체') {
$('#vrfAll').text(msg);
arguments.IsValid = false;
} else {
arguments.IsValid = true;
}
}
ErrorMessage에 지정한 값이 아닌 원하는 값을 보여주고자 하는 경우 사용.