Solved

Custom Validator Dynamic Error Message

Posted on 2013-12-15
1
470 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now