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

x
?
Solved

CompareValidator error message

Posted on 2013-12-04
3
Medium Priority
?
268 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

722 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