private void CreateOfficeClassRadioButtons() { // initial office class selection is from Query String as string ordinal var initialOfficeClass = Offices.GetValidatedOfficeClass(GetQueryString("class")); // iterator options var iteratorOptions = GetOfficeClassesOptions.IncludeAll; switch (AdminPageLevel) { case AdminPageLevel.State: iteratorOptions |= GetOfficeClassesOptions.IncludeCongress | GetOfficeClassesOptions.IncludeState; break; case AdminPageLevel.County: iteratorOptions |= GetOfficeClassesOptions.IncludeCounty; break; case AdminPageLevel.Local: iteratorOptions |= GetOfficeClassesOptions.IncludeLocal; break; } // create a button for each OfficeClass returned by the iterator foreach (var officeClass in Offices.GetOfficeClasses(iteratorOptions)) { var listItem = new ListItem(); RadioButtonListOfficeClass.Items.Add(listItem); listItem.Value = officeClass.ToInt() .ToString(CultureInfo.InvariantCulture); listItem.Selected = officeClass == initialOfficeClass; var text = GetOfficeClassDescription(officeClass.ToOfficeClass(), shortDesc: true) + " ({0})"; var politicianCount = PoliticiansAdminReportView.CountData( GetPoliticiansAdminReportOptions(officeClass)); listItem.Text = string.Format(text, politicianCount); } }