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

Dawood AbbasPosted Apr 2, 2015, 10:00 AM
I used above code then in old date getting '1/1/0001' where as in my grid cell i have '4/1/2015'
Dawood AbbasPosted Apr 2, 2015, 9:57 AM
Dawood AbbasPosted Apr 2, 2015, 9:56 AM
Azaad AbbasPosted Apr 2, 2015, 7:40 AM
Saber ShaikhPosted Apr 2, 2015, 6:01 AM
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/
Akhil GargPosted Apr 2, 2015, 3:33 AM