TextBox2
is
Status
and
TextBox1
is
Action
. You are doing it wrong.
It should be something like...
TextBox txtAction = (TextBox)e.Row.FindControl("TextBox1");
TextBox txtStatus = (TextBox)e.Row.FindControl("TextBox2");
bool status;
if (Boolean.TryParse(txtStatus.Text, out status))
{
txtAction.Text = "Take";
}
else
{
txtAction.Text = "Available";
}
Note: Please change your control IDs to meaningful names, not
TextBox1
and
TextBox2
.