Hi
Pls suggest me the best possible way to accept date from user . Date should not be less than Server Date
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
tony richPosted Jun 18, 2011, 2:49 PM
Jiteendra SampathiraoPosted Jun 9, 2011, 2:37 PM
write the functionality.....in the code behind........
apply the auto postback property to the control where u are offering date from user...
In the control related event write the datetime difference function......
Refer this link:
http://www.homeandlearn.co.uk/csharp/csharp_s14p1.html
Check the download link: for validation and all....
Modify below code to your requirement:
protected void Page_Load(object sender, EventArgs e)
{
// Declare and get DateTime values
DateTime StartDate = System.DateTime.Now;
DateTime EndDate = System.DateTime.UtcNow;
// Find time difference between two dates
TimeSpan TimeDifference = StartDate - EndDate;
// Write difference in hours and minutes
Response.Write("Time difference between server time and Coordinated Universal Time (UTC) is " +
TimeDifference.Hours.ToString() + " hours ");
if (TimeDifference.Minutes != 0)
Response.Write(" and " + TimeDifference.Minutes.ToString() + " minutes.");
}
Praneeth KumarPosted Jun 9, 2011, 1:02 PM
P.S:I would always advice client side validation.
Regards,
Praneeth