void ControlTreeDataLoader.LoadData() { CssClass = CssClass.ConcatenateWithSpace(CheckBoxListCssElementCreator.CssClass); var table = new DynamicTable { Caption = caption }; if (includeSelectAndDeselectAllButtons) { table.AddActionLink(new ActionButtonSetup("Select All", new CustomButton(() => string.Format(@"toggleCheckBoxes( '{0}', true )", ClientID)))); table.AddActionLink(new ActionButtonSetup("Deselect All", new CustomButton(() => string.Format(@"toggleCheckBoxes( '{0}', false )", ClientID)))); } var itemsPerColumn = (int)Math.Ceiling((decimal)items.Count() / numberOfColumns); var cells = new List <EwfTableCell>(); for (byte i = 0; i < numberOfColumns; i += 1) { var maxIndex = Math.Min((i + 1) * itemsPerColumn, items.Count()); var place = new PlaceHolder(); for (var j = i * itemsPerColumn; j < maxIndex; j += 1) { var item = items.ElementAt(j); var checkBox = new BlockCheckBox(selectedItemIds.Contains(item.Id), label: item.Label, highlightWhenChecked: true, postBack: postBack); place.Controls.Add(checkBox); checkBoxesByItem.Add(item, checkBox); } cells.Add(place); } table.AddRow(cells.ToArray()); Controls.Add(table); }
/// <summary> /// Creates a block-level radio button that is part of the group. /// </summary> public BlockCheckBox CreateBlockRadioButton(bool isSelected, string label = "", PostBack postBack = null, bool autoPostBack = false) { var checkBox = new BlockCheckBox(formValue, label, postBack) { AutoPostBack = autoPostBack }; checkBoxesAndSelectionStates.Add(Tuple.Create <CommonCheckBox, bool>(checkBox, isSelected)); return(checkBox); }