Esempio n. 1
0
        /// <summary>
        /// Set edit mode for edit comand Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdGroupMembers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["Groupmemberid"] = e.CommandArgument;
                PAP_GroupOwnershipBLL  objGroupOwnershipBLL  = new PAP_GroupOwnershipBLL();
                PAP_GroupOwnershipList objGroupOwnershipList = objGroupOwnershipBLL.GetGroupOwnershipByHHID(Convert.ToInt32(Session["HH_ID"]));
                if (objGroupOwnershipList.Count > 0)
                {
                    for (int iset = 0; iset < objGroupOwnershipList.Count; iset++)
                    {
                        if (Convert.ToString(ViewState["Groupmemberid"]) == Convert.ToString(objGroupOwnershipList[iset].Groupmemberid))
                        {
                            txtMeberSurname.Text   = objGroupOwnershipList[iset].SurnameIN;
                            txtMeberFirstname.Text = objGroupOwnershipList[iset].FirstnameIN;
                            txtMeberOthername.Text = objGroupOwnershipList[iset].OthernameIN;
                            txtMeberFullname.Text  = txtMeberSurname.Text + " " + txtMeberFirstname.Text;
                            btnSavemember.Text     = "Update";
                            btnClearMember.Text    = "Cancel";
                        }
                    }
                }
            }
            else if (e.CommandName == "DeleteRow")
            {
                PAP_GroupOwnershipBLL objGroupOwnershipBLL = new PAP_GroupOwnershipBLL();
                objGroupOwnershipBLL.DeleteGroupOwnershipByGMID(Convert.ToInt32(e.CommandArgument));
                // Reload Pap Details
                ReCache(Convert.ToInt32(Session["HH_ID"]));

                ViewState["RELATION_ID"]   = "0";
                txtMeberSurname.Text       = "";
                txtMeberFirstname.Text     = "";
                txtMeberOthername.Text     = "";
                txtMeberFullname.Text      = "";
                ViewState["Groupmemberid"] = 0;
                btnSavemember.Text         = "Save";
                btnClearMember.Text        = "Clear";
                BindGrid();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Selected Group Member Deleted successfully');", true);
            }
        }