Example #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 grdSubcounty_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["SUBCOUNTYID"] = e.CommandArgument;
                GetSubCountyById();
                SetUpdateMode(true);
                pnlSubCountyDetails.Visible = true;
                pnlSearch.Visible           = false;
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["CDAPBUDGETID"] = e.CommandArgument;
                SubCountyBLL SubCountyBLLobj = new SubCountyBLL();
                message = SubCountyBLLobj.DeleteSubCounty(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                BindGrid();
                ClearData();
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }