Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In Run Mode Repeater control as follows
C#
Course Name    Amount     CourseDate

 RPST           450        29  APR 2014
 RAFF           500        29  APR 2014


I have one Button called Submit.

When i click the Submit button i want to validate the RPST and RAFF date must not be same date.
i need the RPST date is 29 APR 2014 and RAFF date is 30 APR 2014 in repeater control.


for that how can i validate in asp.net using c#.

Excepted Output as follows
C#
Course Name    Amount     CourseDate

RPST           450        29  APR 2014
RAFF           500        30  APR 2014
Posted
Updated 2-May-14 2:29am
v2
Comments
Sergey Alexandrovich Kryukov 2-May-14 17:04pm    
It depends on what do you have on input. It does not related to any particular control.
—SA

1 solution

Please see my comment to the question. If you really have some dates in your C# code, your can compare them using the '==' operator defined for the type System.DateTime. If you have two points in time with the same date, the time values, obviously, can still be different, so you make them the same (and then only date part will affect the comparison) by using the property System.DateTime.Date:
http://msdn.microsoft.com/en-us/library/system.datetime.date.aspx[^].

And, finally, if it so happens that on input you have just the string representing date/time in some format, you can parse it to DateTime using one of the System.DateTime methods Parse, ParseExact, TryParse or TryParseExact you will find here:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].

—SA
 
Share this answer
 

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