Solved

Custom Validator Dynamic Error Message

Posted on 2013-12-15
1
476 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…
Suggested Courses

636 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