0

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.

1 Answer 1

1

You have two options here

Option 1

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';

Option 2

Set ClientIDMode = "Static"

Mark UP

<asp:CustomValidator ID="cmp" runat="server" ClientIDMode="Static" ErrorMessage="hello"></asp:CustomValidator>

JavaScript Code

document.getElementById('cmp').style.visibility = "visible";
document.getElementById('cmp').innerHTML = 'Error!';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.