Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Custom Validator Dynamic Error Message

Posted on 2013-12-15
1
Medium Priority
?
477 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 2000 total points
ID: 39720449
In your event ValidateLineCode just add the line LineCodeCustomValidator.ErrorMessage = "The Error Message of Your Choice";
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

688 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