Let say there is a RequiredFieldValida开发者_高级运维tor and when validation happens I want to make some changes on the page (like show a hidden div) if validation fails,
Is there a way to call a function in js when the validation ends?! or do you have any other idea?!
Thanks,
Adler!
Why not write your own validator that extends RequiredFieldValidator?
This tutorial looks like it could help point you in the right direction:
Or you can write custom client side java validator:
<script type="text/javascript" language="javascript">
function ValidateDropDown(source, arguments) {
if (arguments.Value === 'NA') {
arguments.IsValid = false;
}
}
</script>
<asp:CustomValidator ID="CoverServerCustomValidator" runat="server" ErrorMessage="<img src='../Themes/WebOrder/Images/weborder_Error.png'>"ToolTip="A Size is Required" Display="Dynamic" CssClass="Error" ValidationGroup="Sizing" OnServerValidate="ValidateDropDown" ControlToValidate="ddlCover" EnableClientScript="true"></asp:CustomValidator>
精彩评论