Click here to Skip to main content
16,018,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...
How to compare Two dates in gridview? asp.net validation
thnksss..
Posted

1 solution

C#
if(e.Row.RowType == DataControlRowType.DataRow)
    {
        DateTime myDate = (DateTime)DataBinder.Eval(e.Row.DataItem, "DateProperty");
        if(DateTime.Now.Substract(myDate).TotalHours>24)
        {
            //error message...
        }
    }
 
Share this answer
 
Comments
rosren 4-Dec-12 22:58pm    
Hi, I want to compare 2 textboxs with date in gridview
such a way that one must be less than other.

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