Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

There is a DateTimeControl on my WebPage which i is a ReqiredField. I have set the properties of the control as follows

<SharePoint:DateTimeControl runat="server" ID="txtDOB" DateOnly="True" LocaleId="2057" IsRequiredField="true" ErrorMessage="*">
</SharePoint:DateTimeControl>

I have set the Error Message to * but i get the mesage as You must specify a value for this required field. instead of *

Please help me to display ErrorMEssage as * instead of the default long message. How can i do it?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

For Custom Error Message you use this Code..

<sharepoint:datetimecontrol id="dteDemo" runat="server" dateonly="true" />
<asp:CompareValidator ID="valDate" runat="server" ForeColor="Red" ControlToValidate="dteDemo$dteDemoDate"
            Type="Date" Operator="DataTypeCheck" ErrorMessage="*">
</asp:CompareValidator>
share|improve this answer
    
ControlToValidate="dteDemo$dteDemoDate" how do i set it to my control id ID="txtDOB" should it be ControlToValidate="txtDOB$txtDOBDate" –  Ishan Mar 19 '12 at 7:09
    
just try and see the result Ishan –  Ravi Suthar Mar 19 '12 at 7:19
    
Welll i used required field validator.thank you for the help. can u please explain me what dteDemo$dteDemoDate means? What this does? Because in ControlToValidate we only specify control ID, without any dollar or anything. –  Ishan Mar 19 '12 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.