protected void ButtonAddBallotMeasures_OnClick(object sender, EventArgs e) { AddBallotMeasuresRecased.Value = string.Empty; switch (AddBallotMeasuresReloading.Value) { case "loadballotmeasure": { AddBallotMeasuresReloading.Value = string.Empty; AddBallotMeasuresAnimate.Value = "true"; AddBallotMeasuresSubTabIndex.Value = "0"; var referendumKey = GetBallotMeasureKey(); if (referendumKey == "add") { HeadingAddBallotMeasuresBallotMeasure.InnerHtml = "Adding new ballot measure"; ContainerAddBallotMeasures.AddCssClasses("update-all"); _AddBallotMeasuresTabInfo.Reset(); FeedbackAddBallotMeasures.AddInfo("Blank form loaded for new ballot measure."); } else { HeadingAddBallotMeasuresBallotMeasure.InnerHtml = Referendums.GetReferendumTitle(GetElectionKey(), referendumKey); ContainerAddBallotMeasures.RemoveCssClass("update-all"); _AddBallotMeasuresTabInfo.LoadControls(); FeedbackAddBallotMeasures.AddInfo("Ballot measure loaded."); } RefreshAddBallotMeasuresTab(); } break; case "": AddBallotMeasuresAnimate.Value = "false"; var listChanged = false; if (GetBallotMeasureKey() == "add") { if (_AddBallotMeasuresTabInfo.Validate()) { // add, then update listChanged = true; Elections.ActualizeElection(GetElectionKey()); var newReferendumKey = Referendums.GetUniqueKey(GetElectionKey(), ControlAddBallotMeasuresReferendumTitle.GetValue()); AddBallotMeasure(newReferendumKey); ContainerAddBallotMeasures.RemoveCssClass("update-all"); SelectedBallotMeasureKey.Value = newReferendumKey; _AddBallotMeasuresTabInfo.Update(FeedbackAddBallotMeasures, false); RefreshAddBallotMeasuresTab(); FeedbackAddBallotMeasures.Clear(); FeedbackAddBallotMeasures.AddInfo("Ballot measure added."); } } else { // normal update _AddBallotMeasuresTabInfo.Update(FeedbackAddBallotMeasures); listChanged |= AddBallotMeasuresTabItem.ListChanged; RefreshAddBallotMeasuresTab(); } AddBallotMeasuresRecased.Value = string.Join("|", _AddBallotMeasuresTabInfo.WithWarning("recased") .Select(item => item.Description)); if (listChanged) { _SelectBallotMeasureControlInfo.LoadControls(); UpdatePanelSelectBallotMeasure.Update(); HeadingAddBallotMeasuresBallotMeasure.InnerHtml = Referendums.GetReferendumTitle(GetElectionKey(), GetBallotMeasureKey()); } break; default: throw new VoteException("Unknown reloading option"); } }