Solved

CompareValidator error message

Posted on 2013-12-04
3
264 Views
Last Modified: 2013-12-19
how can I automatically set ErrorMessage text to whatever is in the ValueToCompare?
a bit like Please enter a date less than {0} type of thing?

I change ValueToCompare in code-behind, does ErrorMessage need changed in code-behind too or can I use something like {0} ?



            <asp:CompareValidator
                ID="dateValidator" runat="server"
                Type="Date"
                ValueToCompare="30/11/2013"
                Operator="LessThanEqual"
                ControlToValidate="txtDateEnd"
                ErrorMessage="Please enter a date less than 30/11/2013 "></asp:CompareValidator>
0
Comment
Question by:rwallacej
[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
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 39697428
I think the only way to do this will be to update the errormessage from the code behind at the same time as you update the ValueToCompare that will ensure consistency and is the only way possible afaik.

Does the date have any relevance is it always today's date or end of month date?

If it is todays date then there may be a way to do it in the markup or you could just change the message to be more generic such as 'Please enter a date before today' or 'Please enter a date before month end'.
0
 

Author Comment

by:rwallacej
ID: 39698735
Does the date have any relevance is it always today's date or end of month date?
- no
0
 

Author Closing Comment

by:rwallacej
ID: 39729648
Wrote code to set the values in code behind as can't be automated
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
SQL Server Serialization error 8 47
Error in Visual Project 10 48
Datatable / Dates ? 4 31
How to send the email using C# with embedded HTML TABLE 3 19
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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