Example #1
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label      lblID        = (Label)e.Row.FindControl("lblID");
                LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                int        id           = 0;
                Int32.TryParse(lblID.Text, out id);

                bool enable = dal_inventory.CheckDelete(id);
                lnkbtnDelete.Enabled = enable;
                if (!enable)
                {
                    lnkbtnDelete.OnClientClick = "";
                }
            }
        }