Custom Validator Dynamic Error Message
Posted on 2013-12-15
I have a multi line textbox that a user can enter up to 50 codes. Once they click the submit button, each code is validated to make sure that it is a valid code. If any of the codes are invalid then Page.IsValid = false and none of the codes are written to the database.
In the event of error, there is a custom validator that returns a Message that says "Invalid Line Code". The user has requested to know which line code was invalid.
Is there a way I can display a dynamic error message that will show the line code that is incorrect.
This is the way the code looks now.
<asp:CustomValidator runat="server" ID="LineCodeCustomValidator" ValidationGroup="NewAdjValGrp"
OnServerValidate="ValidateLineCode" Display="None" ErrorMessage="Valid Line Code Required"