use
RowDataBound[
^] Event
for
label
control you will have to use the
Text
property to read the text value
I suspect the command buttons are not labels, it should be a button or linkbutton control. please check that and change the casting control
void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
GridViewRow row = (GridViewRow)e.Row;
Label myTextBox = row.FindControl("lbl_SignOff") as Label;
if (myTextBox.Text == "Yes")
{
LinkButton btnUpdate = row.FindControl("btn_Update") as LinkButton;
LinkButton btnCancel = row.FindControl("btn_Cancel") as LinkButton;
btnUpdate.Visible = false;
btnCancel.Visible = false;
}
}
}