<pre> } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { GridView1.Columns[4].Visible = false; Label a = e.Row.FindControl("Label2") as Label; Label b = e.Row.FindControl("Label3") as Label; if ((a != null) & (b!= null)) { DateTime lblDate; if ((!DateTime.TryParse(a.Text, out lblDate)) & (!DateTime.TryParse(b.Text, out lblDate))) { // date time conversion not success // you may have empty or invalid datetime // do something in this case return; } if (lblDate <= DateTime.Today.AddDays(45)) { e.Row.Visible = true; } else { e.Row.Visible = false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)