コード例 #1
0
ファイル: Title.aspx.cs プロジェクト: NetworksAuro/Networks
        protected void grdTitle_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                ImageButton lnkDelete = grdTitle.Rows[e.RowIndex].FindControl("lnkDelete") as ImageButton;
                HiddenField hdfStateid = grdTitle.Rows[e.RowIndex].FindControl("hdfStateid") as HiddenField;

                if (lnkDelete.CommandArgument.ToString().Trim().ToUpper() == "Inactive".Trim().ToUpper())
                {
                    HiddenField hdftitle_id = grdTitle.Rows[e.RowIndex].FindControl("hdftitle_id") as HiddenField;
                    int afctrows;
                    objData = new MasterData();
                    afctrows = objData.Title_Delete(Convert.ToInt32(hdftitle_id.Value.Trim()));
                    if (afctrows == 103)
                    {
                        lblerrmsg.Text = "Title can’t be deleted as is in use by an Personal";
                        return;
                    }
                    grdfill();
                    divmsg.InnerHtml = "Record deleted successfully.";
                }
                else
                {
                    HiddenField hdftitle_id = grdTitle.Rows[e.RowIndex].FindControl("hdftitle_id") as HiddenField;
                    int afctrows;
                    objData = new MasterData();
                    afctrows = objData.Title_Activate(Convert.ToInt32(hdftitle_id.Value.Trim()));
                    grdfill();
                    divmsg.InnerHtml = "Record activated successfully.";
                }

            }
            catch (Exception ex)
            {

                showerror(ex);
            }
        }