private void SetAllStateCheckboxes(bool value) { foreach (var stateCode in StateCache.All51StateCodes) { var id = GetStateCheckboxId(stateCode); var checkbox = StatesPlaceHolder.FindControl(id) as HtmlInputCheckBox; if (checkbox != null) { checkbox.Checked = value; } } }
private List <string> GetSelectedStates() { // Return a list of currently-selected state codes var selectedStates = new List <string>(); foreach (var stateCode in StateCache.All51StateCodes) { var id = GetStateCheckboxId(stateCode); var checkbox = StatesPlaceHolder.FindControl(id) as HtmlInputCheckBox; if (checkbox?.Checked == true) { selectedStates.Add(stateCode); } } return(selectedStates); }