void LoadGroup() { try { Session["Grouplst"] = BLLGroup.GetGroupList(int.Parse(this.ddlOrg.SelectedValue), false, 'C'); this.lstCommittee.DataSource = Session["GroupLst"]; this.lstCommittee.DataTextField = "GroupName"; this.lstCommittee.DataValueField = "GroupID"; this.lstCommittee.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (this.ddlOrg.SelectedIndex <= 0) { this.lblStatusMessage.Text = "Please select organization from list."; this.programmaticModalPopup.Show(); return; } ATTGroup obj = new ATTGroup(); obj.OrgID = int.Parse(this.ddlOrg.SelectedValue); obj.GroupID = 0; obj.GroupName = this.txtCommittee.Text.Trim(); obj.Description = this.txtDescription.Text.Trim(); obj.Active = (this.chkActive.Checked == true) ? "Y" : "N"; obj.Type = 'C'; ObjectValidation result = BLLGroup.Validate(obj); if (result.IsValid == false) { this.lblStatusMessage.Text = result.ErrorMessage; this.programmaticModalPopup.Show(); return; } if (this.lstCommittee.SelectedIndex < 0) { obj.Action = "A"; } else { obj.GroupID = int.Parse(this.lstCommittee.SelectedValue); obj.Action = "E"; } BLLGroup.AddGroup(obj); if (obj.Action == "A") { ((List <ATTGroup>)Session["GroupLst"]).Add(obj); } else { ((List <ATTGroup>)Session["GroupLst"])[this.lstCommittee.SelectedIndex] = obj; } Session["Grouplst"] = BLLGroup.GetGroupList(int.Parse(this.ddlOrg.SelectedValue), false, 'C'); this.lstCommittee.DataSource = Session["GroupLst"]; this.lstCommittee.DataTextField = "GroupName"; this.lstCommittee.DataValueField = "GroupID"; this.lstCommittee.DataBind(); this.ClearME(); this.lblStatusMessage.Text = "Committee successfully saved."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }