Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have the following validator in my project which validates the dates entered in two fields like so:
C#
<asp:CompareValidator ID="CompareValidator10" runat="server"  ValidationGroup="dateDaysGroup" ControlToValidate="EndDate" ControlToCompare="StartDate" Type="Date" Operator="GreaterThan" ErrorMessage="End Date must be after Start Date." Display="Dynamic"></asp:CompareValidator>


is there a way i can call a method from the server side to only trigger the validator above if the start and end date are different? i.e

could i do something like this:

C#
public void CheckDates()
{
  if(startDate != endDate)
{
  //trigger validator (basically make it active)
}

}


is there a way i could call the CheckDates() in the CompareValidator in the client side? is this even possible?

What I have tried:

I'm not really if this is possible but i have tried to research on googl.com
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900