CheckBoxList Check

The CheckBoxList control allows you to select one or more values from a data source.
If the DataType is set as Boolean, it automatically converts the selected value to true.
 
Personalization
We can set up a custom data source by specifying the ControlClass value for DataSourceMode and putting namespace and class name in the CustomControlClass control's property. 
 
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using DataWeb.Structure;
using DataWeb.Identity;

namespace MyApp.DataWeb.Data.Controls
{
    public class Control_VisibleRoles : CheckBoxList
    {
        private readonly IUserService userService;

        public Control_VisibleRoles(Form form, IServiceProvider serviceProvider) : base(form, serviceProvider)
        {
            userService = serviceProvider.GetService<IUserService>();
        }

        public override async Task<IEnumerable<List.ListItem>> GetListValuesAsync(Dictionary<string, object> parameters, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
        {
            var roles = await userService.GetRolesAsync();
            return roles.Select(x => new List.ListItem { Title = x.Name, Value = x.Name });
        }
    }
}