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";
}
}}


Akhil GargRank #772 · 3K reputationPosted Apr 1, 2015, 11:33 PM EDT
Saber ShaikhRank #1,686 · 905 reputationPosted Apr 2, 2015, 2:01 AM EDT
if is blank the false you error other wise out put proper so only Check if condition before
DateTime olddate = Convert.ToDateTime(e.Row.Cells[9].Text); /*Error : String was not
Blog : http://aspnettutorialscode.blogspot.in/
Azaad Abbas127 reputationPosted Apr 2, 2015, 3:40 AM EDT
Dawood AbbasRank #6,413 · 267 reputationPosted Apr 2, 2015, 5:56 AM EDT
Dawood AbbasRank #6,413 · 267 reputationPosted Apr 2, 2015, 5:57 AM EDT
Dawood AbbasRank #6,413 · 267 reputationPosted Apr 2, 2015, 6:00 AM EDT
I used above code then in old date getting '1/1/0001' where as in my grid cell i have '4/1/2015'