Dawood Abbas

Dawood Abbas

  • NA
  • 264
  • 95.3k

How to compare Date values in DataGrid with Current date?

Apr 2 2015 1:17 AM
I have tried with
protected void gridCustomer_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime olddate = Convert.ToDateTime(e.Row.Cells[9].Text);  /*Error : String was not recognized as a valid DateTime.*/
DateTime today = DateTime.Now;
if (olddate > today)
                {
                    Label status = (Label) e.Row.FindControl("lblStatus");
                    status.Text = "AutoHold";
                }    
}


Answers (6)