protected void btnDelete_Click(object sender, EventArgs e) { act_change acObj = new act_change(); if (!Request.QueryString.Get("acrid").ToString().Equals("-1")) { if (hfDelete.Value == "Yes") { acObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("acrid").ToString())); acObj.DeleteCurrentRow(); acObj.Save(); InjectScript.Text = "<script>CloseAndRebind()</" + "script>"; } } }
protected void Page_Load(object sender, EventArgs e) { txtNewActivityDesc.Attributes.Add("onKeyUp", "calCharNumber1()"); txtNewCoreIndicatorDesc.Attributes.Add("onKeyUp", "calCharNumber2()"); if (!Page.IsPostBack) { SqlDS_RLcoreindi_Get.DataBind(); cblCoreIndicators.DataBind(); lblMsg.Text = ""; lp_local_plan lpObj = new lp_local_plan(); if (lpObj.LoadByPrimaryKey(Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()))) { lblCollege.Text = lpObj.Txt_college_name; lblFiscalYear.Text = lpObj.Nbr_fiscal_year.ToString(); } act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); if (actObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("aid").ToString()))) { lblAvtivityNbr.Text = actObj.Key_activity_id.ToString(); lblActivityName.Text = actObj.Txt_activity_name; lblActivityDesc.Text = actObj.Txt_activity_desc; try { lblCoreIndicatorDesc.Text = actObj.Txt_activity_core_indicator_desc; //txtNewCoreIndicatorDesc.Text = actObj.Txt_activity_core_indicator_desc; } catch { lblCoreIndicatorDesc.Text = ""; //txtNewCoreIndicatorDesc.Text = ""; } //try //{ // cbApproved.Checked = actObj.Flg_approved; //} //catch //{ // cbApproved.Checked = false; //} } if (Request.QueryString.Get("acrId").ToString().Equals("-1")) { //Add new btnDelete.Visible = false; btnSave.Text = "Add"; lblAvtivityNbr.Text = ""; lblDateCreated.Text = DateTime.Now.ToShortDateString(); txtNewActivityName.Text = actObj.Txt_activity_name; //txtNewActivityDesc.Text = actObj.Txt_activity_desc; } else { // Edit btnDelete.Visible = true; btnSave.Text = "Save"; act_change acObj = new act_change(); if (acObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("acrId").ToString()))) { txtNewActivityName.Text = acObj.Txt_activity_name_new; try { txtNewCoreIndicatorDesc.Text = acObj.Txt_activity_core_indicator_desc_new; } catch { txtNewCoreIndicatorDesc.Text = ""; } try { txtNewActivityDesc.Text = acObj.Txt_activity_desc_new; } catch { txtNewActivityDesc.Text = ""; } try{ cbApproved.Checked = acObj.Flg_approved; } catch{ cbApproved.Checked = false; } if (cbApproved.Checked) { btnSave.Enabled = false; cbApproved.Enabled = false; } else { btnSave.Enabled = true; cbApproved.Enabled = true; } lblDateCreated.Text = acObj.Dte_create_date.ToShortDateString(); } } } }