protected void UnAssignButton_Click(object sender, EventArgs e) { if (Session["SelectedPlayer"] != null) { SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyFootballConnectionString"].ConnectionString); try { myConnection.Open(); SqlCommand myCommand = new SqlCommand("UPDATE [assignments] SET [rosterId] = 0, [round] = 0, [pick] = 0 WHERE ([playerId] = " + Session["SelectedPlayer"] + ")", myConnection); myCommand.ExecuteNonQuery(); myConnection.Close(); } catch (Exception ex) { } finally { QBsListBox.ClearSelection(); RBsListBox.ClearSelection(); WRsListBox.ClearSelection(); TEsListBox.ClearSelection(); DSTsListBox.ClearSelection(); KsListBox.ClearSelection(); RosterListBox.ClearSelection(); Session.Add("SelectedPlayer", "0"); updatePicks(); } } }
protected void DSTsListBox_SelectedIndexChanged(object sender, EventArgs e) { Session.Add("SelectedPlayer", DSTsListBox.SelectedValue); QBsListBox.ClearSelection(); RBsListBox.ClearSelection(); WRsListBox.ClearSelection(); TEsListBox.ClearSelection(); KsListBox.ClearSelection(); initializePick(); updatePicks(); }