Exemplo 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 grdGrievancesCategory_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["GRIEVANCECATEGID"] = e.CommandArgument;
                GetGrievancesCategoryDetails();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                GrievancesMasterBLL GrievancesMasterBLLobj = new GrievancesMasterBLL();
                string message = string.Empty;

                message = GrievancesMasterBLLobj.DeleteGrievancesCategory(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                SetUpdateMode(false);
                clearfields();
                BindGrid(false, true);
            }
        }