protected void grdPDView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblComplete = (Label)e.Row.FindControl("lblComplete"); Label lblvisitDate = (Label)e.Row.FindControl("lblVisitDate"); LinkButton lnkbtnsurvey = (LinkButton)e.Row.FindControl("lnkbtnNewSurvey"); toGetInfo setinfo = new toGetInfo(); setinfo.setVisitDate(lblvisitDate.Text); if (string.IsNullOrEmpty(lblComplete.Text)) { lblComplete.Visible = false; lnkbtnsurvey.Visible = true; } else if (!string.IsNullOrEmpty(lblComplete.Text)) { if (lblComplete.Text == "Completed") { lnkbtnsurvey.Visible = false; lblComplete.Visible = true; } else { lnkbtnsurvey.Visible = true; lblComplete.Visible = false; } } } }