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); }
protected override void loadData() { var table = new DynamicTable( new EwfTableColumn( "Email", Unit.Percentage( 50 ) ), new EwfTableColumn( "Role", Unit.Percentage( 50 ) ) ); table.AddActionLink( new ActionButtonSetup( "Create User", new EwfLink( new EditUser.Info( es.info, null ) ) ) ); foreach( var user in UserManagementStatics.GetUsers() ) table.AddTextRow( new RowSetup { ClickScript = ClickScript.CreateRedirectScript( new EditUser.Info( es.info, user.UserId ) ) }, user.Email, user.Role.Name ); ph.AddControlsReturnThis( table ); }
/// <summary> /// Creates a check box list. /// </summary> public EwfCheckBoxList( IEnumerable <SelectListItem <ItemIdType> > items, IEnumerable <ItemIdType> selectedItemIds, string caption = "", bool includeSelectAndDeselectAllButtons = false, byte numberOfColumns = 1, FormAction action = null) { this.items = items.ToArray(); selectedItemIds = selectedItemIds.ToArray(); 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)this.items.Count() / numberOfColumns); var cells = new List <EwfTableCell>(); for (byte i = 0; i < numberOfColumns; i += 1) { var maxIndex = Math.Min((i + 1) * itemsPerColumn, this.items.Count()); var place = new PlaceHolder(); for (var j = i * itemsPerColumn; j < maxIndex; j += 1) { var item = this.items.ElementAt(j); var checkBox = new BlockCheckBox( selectedItemIds.Contains(item.Id), (postBackValue, validator) => { }, label: item.Label, setup: new BlockCheckBoxSetup(highlightedWhenChecked: true, action: action)); place.Controls.Add(checkBox); checkBoxesByItem.Add(item, checkBox); } cells.Add(place); } table.AddRow(cells.ToArray()); Controls.Add(table); }
protected override void loadData() { var table = new DynamicTable(new EwfTableColumn("Email", Unit.Percentage(50)), new EwfTableColumn("Role", Unit.Percentage(50))); table.AddActionLink(new ActionButtonSetup("Create User", new EwfLink(new EditUser.Info(es.info, null)))); foreach (var user in UserManagementStatics.GetUsers()) { table.AddTextRow(new RowSetup { ClickScript = ClickScript.CreateRedirectScript(new EditUser.Info(es.info, user.UserId)) }, user.Email, user.Role.Name); } ph.AddControlsReturnThis(table); }