Reputation: 13
I have grid on the page and text box inside its one of the column as item template. I have used custom validator's clientValidationfuntion to validate the text entered on the Text box.
The javascript function which I used in ClientValidationFunction is properly called, also its setting the
args.isvalid = false
inside the javascript function but the error mesaage is not being displayed on the page.
Both the grid and custom validator controls are inside the same Update Panel control.
Please suggest what could be the problem.
Upvotes: 0
Views: 566
Reputation: 1076
You have two options here
Go to the View Source
and check how the complete ID is being rendered. Now in the JavaScript function
write the below code.
document.getElementById('CompleteValidatorID').style.display = 'none';
Set ClientIDMode = "Static"
<asp:CustomValidator ID="cmp" runat="server" ClientIDMode="Static" ErrorMessage="hello"></asp:CustomValidator>
document.getElementById('cmp').style.visibility = "visible";
document.getElementById('cmp').innerHTML = 'Error!';
Upvotes: 1