Solved

Custom Validator Dynamic Error Message

Posted on 2013-12-15
1
474 Views
Last Modified: 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"

EnableClientScript="true" />
0
Comment
Question by:sherbug1015
1 Comment
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 39720449
In your event ValidateLineCode just add the line LineCodeCustomValidator.ErrorMessage = "The Error Message of Your Choice";
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question