Esempio n. 1
0
        protected void grdState_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                ImageButton lnkDelete = grdState.Rows[e.RowIndex].FindControl("lnkDelete") as ImageButton;
                HiddenField hdfStateid = grdState.Rows[e.RowIndex].FindControl("hdfStateid") as HiddenField;

                if (lnkDelete.CommandArgument.ToString().Trim().ToUpper() == "Inactive".Trim().ToUpper())
                {

                    int afctrows;
                    objData = new MasterData();
                    afctrows = objData.State_Delete(Convert.ToInt32(hdfStateid.Value.Trim()));
                    if (afctrows == 103)
                    {
                        lblerrmsg.Text = "State can’t be deleted as is in use by an city";
                        return;
                    }
                    grdfill();
                    divmsg.InnerHtml = "Record deleted successfully.";
                    (this.Master as Site1).ClearModifyStatus();
                }
                else
                {
                    int afctrows;
                    objData = new MasterData();
                    afctrows = objData.State_Activate(Convert.ToInt32(hdfStateid.Value.Trim()));
                    grdfill();
                    divmsg.InnerHtml = "Record activated successfully.";
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }