void LoadReligions() { try { List <ATTReligion> lstReligions; lstReligions = BLLReligion.GetReligions(null, 1); Session["Religions"] = lstReligions; this.grdReligions.DataSource = lstReligions; this.grdReligions.DataBind(); } catch (Exception ex) { throw ex; } }
void LoadReligions() { try { List <ATTReligion> lstReligions; lstReligions = BLLReligion.GetReligions(null, 0); this.ddlReligion.DataSource = lstReligions; this.ddlReligion.DataTextField = "ReligionNepName"; this.ddlReligion.DataValueField = "ReligionId"; this.ddlReligion.SelectedIndex = 0; this.ddlReligion.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
protected void btnSave_Click(object sender, EventArgs e) { try { lblStatusMessage.Text = ""; List <ATTReligion> lstReligions = (List <ATTReligion>)Session["Religions"]; int religionID = 0; if (this.grdReligions.SelectedIndex > -1) { religionID = lstReligions[this.grdReligions.SelectedIndex].ReligionId; } ATTReligion objReligions = new ATTReligion(religionID, this.txtRelgNepName_rqd.Text.Trim(), this.txtRelgEngName.Text.Trim()); religionID = BLLReligion.SaveReligions(objReligions); if (this.grdReligions.SelectedIndex > -1) { lstReligions[this.grdReligions.SelectedIndex].ReligionId = religionID; lstReligions[this.grdReligions.SelectedIndex].ReligionNepName = this.txtRelgNepName_rqd.Text.Trim(); lstReligions[this.grdReligions.SelectedIndex].ReligionEngName = this.txtRelgEngName.Text.Trim(); } else { ATTReligion objNewReligions = new ATTReligion(religionID, this.txtRelgNepName_rqd.Text.Trim(), this.txtRelgEngName.Text.Trim()); lstReligions.Add(objNewReligions); } Session["Religions"] = lstReligions; this.grdReligions.DataSource = lstReligions; ClearComponents(); this.lblStatusMessage.Text = "Successfully Saved"; this.programmaticModalPopup.Show(); this.grdReligions.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }