///////////////////
JAVASCRIPT-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
//////////////////
HTML-
JAVASCRIPT-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).on("click", "#CheckBoxValidator1", function () {
var valEmail = $("[id*=RequiredValidator1]");
ValidatorEnable(valEmail[0], $(this).is(":checked"));
});
</script>
//////////////////
HTML-
<asp:TextBox ID="txt_CheckValidator" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredValidator1" ControlToValidate="txtEmail"
runat="server"
ErrorMessage="*Required"
ForeColor="Red"
ValidationGroup="Group2"
/>
<br />
Enable Validation:
<input type="checkbox" id="CheckBoxValidator1" checked="checked"
/>
<br />
<asp:Button ID="Button1" Text="Submit" runat="server" ValidationGroup="Group2" />
No comments:
Post a Comment