I'm getting the error "String was not recognized as a valid DateTime".
Explanation of the code below:
I'm trying to loop through the gridview checking for the current date in the column "Extracted Date" of the gridview. If the date is current date, I'm changing the background color to red. If its not the current date, I'm changing the row to orange.
Any kind of help would be appreciated.
protected void BackColor()
DateTime dtHH ;
int intCnt = gvSearchresult.Rows.Count;
for (int i = 0; i < intCnt; i++)
GridViewRow gvRow = gvSearchresult.Rows[i];
string strDate = Convert.ToString(DataBinder.Eval(gvRow.DataItem, "Extracted Date"));
dtHH = Convert.ToDateTime(strDate);
if (dtHH == DateTime.Now.Date)
gvRow.BackColor = System.Drawing.Color.Red;
gvRow.BackColor = System.Drawing.Color.Orange;