This works for Web Application...
Use RowDatabound Event
Here you go
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lbl1 = (Label)e.Row.FindControl("myLabel");
Button btn1 = ((Button)e.Row.FindControl("myButton"));
if(lbl.Value == "")
btn1.Enabled = false;
else
btn1.Enabled= true;
}
}
Here "myLabel" and "myButton" are the ID of the controls in gridview
For more info...have a look at this
rowdatabound-event-of-gridview-of.html[
^]
If you are working on Windows app, then use CellFormatting event of datragridview...
Here is a sample...
windows-forms-datagridview-cellformatting[
^]