I want to add my error message into the Validation Summary from Javascript instead just alert it. Below is my code for my Javascript.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var counter = 0;
$("#addrow").on("click", function () {
var gv = document.getElementById("<%= myTable.ClientID %>");
var tb = gv.getElementsByTagName("input");
for (var i = 0; i < tb.length; i++) {
if (tb[i].type == "text") {
if (tb[i].value < 0.0625) {
alert("Dimensions details cannot be empty!");
return false;
}
}
}
return true;
});
});
</script>
// And I'm using the asp Validation Summary.
<asp:ValidationSummary ID="vsSummary" CssClass="errors" runat="server" ValidationGroup="Group1" ForeColor="Red" />
Is it possible to add the error message into the ASP Validation Summary??
Thanks
You can update html using JavaScript/JQuery.
Check dom, there is available hidden label of validation summary. Update it HTML and make display block.
for hide validation summary you can use fadeOut()
If you not get validation summary label, than just add hidden label and update it html and display it. Hope it works in your case.