예제 #1
0
        protected void gvInitiative_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                btnAdd.Enabled = true;
                RadioButton rbtnUpdateTrue   = (RadioButton)gvInitiative.Rows[e.RowIndex].FindControl("rbtnUpdateTrue");
                RadioButton rbtnUpdateFalse  = (RadioButton)gvInitiative.Rows[e.RowIndex].FindControl("rbtnUpdateFalse");
                RadioButton rbtnVisibleTrue  = (RadioButton)gvInitiative.Rows[e.RowIndex].FindControl("rbtnVisibleTrue");
                RadioButton rbtnVisibleFalse = (RadioButton)gvInitiative.Rows[e.RowIndex].FindControl("rbtnVisibleFalse");
                bool        flagUpdate       = false;
                bool        flagVisible      = false;
                if (rbtnUpdateTrue.Checked)
                {
                    flagUpdate = true;
                }
                if (rbtnVisibleTrue.Checked)
                {
                    flagVisible = true;
                }

                Label lblInitiativeID = (Label)gvInitiative.Rows[e.RowIndex].FindControl("lblInitiativeID");
                int   initiativeID    = Convert.ToInt16(lblInitiativeID.Text.ToString());
                objclsBALApplication = new clsBALApplication();
                objclsBALApplication.UpdateInitiatives(initiativeID, flagUpdate, flagVisible);
                gvInitiative.EditIndex = -1;
                PopulateGrid();
                if (ViewState["SortExpression"] != null && ViewState["sortDirection"] != null)
                {
                    SortGridView(ViewState["SortExpression"].ToString(), ViewState["sortDirection"].ToString());
                }
                lblSuccess.Text = "Initiative updated successfully.";
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  context            = HttpContext.Current;
                LogException objclsLogException = new LogException();
                objclsLogException.LogErrorInDataBase(ex, context);
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }