ListBox25
ListBox25 is a reusable ASP.NET helper control used to render
single-select and multi-select list boxes using standard <select> elements.
It supports labels, required indicators, Select2 integration, auto postback,
JavaScript callbacks, and configurable widths.
Key Features
- Single and multiple selection list boxes
- Label with required (*) indicator
- Predefined and custom widths
- Select2 CSS class integration
- Auto postback support
- JavaScript callback on change
Public Enums
ListBoxType
| Value | Description |
| Single | Single item selection |
| Multiple | Multiple item selection |
Size
| Value | Rendered Width |
| S1 | 50px |
| S2 | 100px |
| S3 | 150px |
| S4 | 200px |
| S5 | 250px |
| Max | 100% |
| Auto | auto |
SimpleListBox
SimpleListBox is used to render a single-selection dropdown list.
Properties
| Property | Type | Description |
| ControlId | string | ID and name of the select element |
| ValueList | List<string> | Display values |
| IdList | List<string> | Option values (optional) |
| SelectedValue | string | Selected item value |
| Label | string | Text label displayed above the list box |
| IsRequired | bool | Shows required (*) indicator |
| PlaceHolder | string | Select2 placeholder text |
| Size | Size | Predefined width |
| CustomWidth | int | Overrides Size with custom width (px) |
| IsPostBack | bool | Submits form on selection change |
| OnClick | string | JavaScript function executed on change |
| IsHeader | bool | Removes bottom margin for header layouts |
Sample Code – SimpleListBox
var listBox = new ListBox25.SimpleListBox
{
ControlId = "Country",
Label = "Country",
IsRequired = true,
ValueList = new List { "India", "USA", "UK" },
SelectedValue = "India",
Size = ListBox25.Size.S3
};
@ListBox25.GetHtml(listBox)
MultiListBox
MultiListBox is used to render a multi-selection list box.
Properties
| Property | Type | Description |
| ControlId | string | ID and name of the select element |
| ValueList | List<string> | Display values |
| IdList | List<string> | Option values (optional) |
| SelectedValues | List<string> | Preselected values |
| Label | string | Text label displayed above the list box |
| IsRequired | bool | Shows required (*) indicator |
| PlaceHolder | string | Select2 placeholder text |
| Size | Size | Width of the control |
Example – MultiListBox
var multiListBox = new ListBox25.MultiListBox
{
ControlId = "Roles",
Label = "User Roles",
ValueList = new List { "Admin", "Editor", "Viewer" },
SelectedValues = new List { "Admin", "Viewer" },
Size = ListBox25.Size.Max
};
@ListBox25.GetHtml(multiListBox)