示例#1
0
 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;
         }
     }
 }
示例#2
0
        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);
        }