protected void Delete_Projects(object sender, EventArgs e) { IList<Int64> projects = new List<Int64>(); try { string collectionProjectIds = selected_projects.Value;// Request.Form["selected"]; string[] projectIdsStrings = {}; if (collectionProjectIds != null && collectionProjectIds.Length > 0) { projectIdsStrings = collectionProjectIds.Split(','); foreach (string projectIdString in projectIdsStrings) { long longValue = Convert.ToInt64(projectIdString); projects.Add(longValue); } } ProjectModule projectModule = new ProjectModule(); projectModule.deleteProjects(projects); error_modal_control.Show(); string successMessage = projects.Count + " project" + (projects.Count > 1 ? "s" : "") +" deleted successfully!"; error_message.Controls.Add(new LiteralControl( "<div class='alert alert-success col-sm-10 col-sm-offset-1'>" + successMessage + "</div>")); okButton.Visible = true; errorButton.Visible = false; company_contacts_updatePanel.Update(); project_list_panel.Update(); selected_projects.Value = ""; selected_projects_panel.Update(); } catch (ApproveProjectException apex) { Messenger.setMessage(error_message, apex.Message, LEVEL.DANGER); company_contacts_updatePanel.Update(); okButton.Visible = false; errorButton.Visible = true; } catch (Exception ex) { error_modal_control.Show(); error_message.Controls.Add(new LiteralControl( "<div class='alert alert-danger col-sm-10 col-sm-offset-1'>" + ex.Message + "</div>")); okButton.Text = "Ok"; company_contacts_updatePanel.Update(); okButton.Visible = false; errorButton.Visible = true; } finally { error_modal_control.Show(); //selected_projects.Value = ""; } }