protected void btnDelete_Click(object sender, EventArgs e) { try { List <ATTInstitution> InstitutionLST = (List <ATTInstitution>)Session["Institution"]; if (lstInstitution.SelectedIndex != -1) { if (BLLInstitution.DeleteInstitution(int.Parse(lstInstitution.SelectedValue)) == true) { InstitutionLST.RemoveAt(lstInstitution.SelectedIndex); lstInstitution.DataSource = InstitutionLST; lstInstitution.DataTextField = "InstitutionName"; lstInstitution.DataValueField = "InstitutionID"; lstInstitution.DataBind(); ClearControl(); } else { this.lblStatusMessage.Text = "Institution doesn't save successfully"; this.programmaticModalPopup.Show(); return; } } else { this.lblStatusMessage.Text = "Select institution for Delete"; this.programmaticModalPopup.Show(); return; } } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { if (lstInstitution.SelectedIndex > -1) { BLLInstitution.DeleteInstitution(int.Parse(lstInstitution.SelectedValue.ToString())); lstInstitution.Items.RemoveAt(lstInstitution.SelectedIndex); txtInstitutionName_Rqd.Text = ""; txtBoardName_Rqd.Text = ""; txtLocation_Rqd.Text = ""; ddlCountry_Rqd.SelectedIndex = -1; lstInstitution.SelectedIndex = -1; chkActive.Checked = false; ddlInstitutionType.SelectedIndex = -1; if (lstInstitution.Items.Count == 0) { Session["Institution"] = new List <ATTInstitution>(); } } else { this.lblStatusMessage.Text = "Select institution for Delete"; this.programmaticModalPopup.Show(); return; } } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }