In Gridview i am using image button that Want to enable based on the value in the Field. My Partial Code is ..
via RowDataBound
(which i prefer):
protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView row = (DataRowView)e.Row.DataItem;
int status = (int)row["fld_status"];
Button btn_delete = (Button) e.Row.FindControl("btn_delete");
btn_delete.Enabled = status != 1;
}
}
from aspx: