Solved

Custom Validator Dynamic Error Message

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Form Data Disappears Using Back Button 4 21
Compute age Html 2 27
Header Font Size in Grid View 6 27
JS to redirect to prev page 8 24
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

733 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