Solution
- Inside the
RowDataBound
Event, find the control. - Run your logic and set
Visible
property to true/false
.
Example
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if(someCondition)
{
ImageButton imgBtn= (ImageButton)e.Row.FindControl("imageButtonId");
imgBtn.Visible = false;
}
}
}