Thursday, January 8, 2015

Control dtToDate referenced by the ControlToCompare property of cmpDates cannot be validated

Hi,

There are two Share point Date time controls with ids dtFromDate,dtToDate.
Have applied the compare validator so that to display message if user selects start date which would be greater than To date.
<asp:CompareValidator ID="cmpDates" runat="server" ControlToValidate="dtFromDate" ControlToCompare="dtToDate" Operator="LessThan" Type="Date"ErrorMessage="From Date should be less than To Date"></asp:CompareValidator>
Started displaying the below error post deploying the web part
From our technical manager, came to know that we need to add extra to the actual id of the SharePoint date time control.
This is required while applying the validation to the SharePoint Date Time control.
So instead of this ControlToValidate="dtFromDate" ControlToCompare="dtToDate" used ControlToValidate="dtFromDate$dtFromDateDate"ControlToCompare="dtToDate$dtToDateDate"

Post that it went fine and validation is working accordingly.

No comments:

Post a Comment