YouTip LogoYouTip

Prop Webcontrol Checkboxlist Cellpadding

## ASP.NET CheckBoxList CellPadding Property The `CellPadding` property is a member of the ASP.NET `CheckBoxList` control. It is used to get or set the amount of space (in pixels) between the border of a table cell and the cell's content (the checkbox and its associated text label). --- ## Definition and Usage The `CellPadding` property controls the internal spacing (padding) within each individual cell of the rendered `CheckBoxList` table. By adjusting this property, you can improve the readability and visual layout of your checkbox lists by preventing the text and checkboxes from being too close to their cell borders. > **Important Note:** This property is only effective when the `RepeatLayout` property of the `CheckBoxList` control is set to `RepeatLayout.Table` (which is the default layout). If `RepeatLayout` is set to `Flow` or other non-table layouts, this property will have no visual effect. --- ## Syntax ```xml ``` ### Property Values | Attribute Value | Description | | :--- | :--- | | **pixels** | An integer value specifying the distance (in pixels) between the cell border and its content. | --- ## Code Example The following example demonstrates how to set the `CellPadding` property of a `CheckBoxList` control to `15` pixels to add comfortable spacing around each checkbox item. ### ASPX Markup ```xml <%@ Page Language="C#" %> CheckBoxList CellPadding Example

CheckBoxList CellPadding Demonstration

``` --- ## Key Considerations 1. **Layout Dependency:** Always ensure that `RepeatLayout` is set to `Table` (default) when using `CellPadding`. If you are using modern CSS layouts (like Flexbox or Grid) by setting `RepeatLayout="Flow"`, you should manage spacing using CSS padding/margin classes instead. 2. **CellSpacing vs. CellPadding:** * `CellPadding` controls the space *inside* the cell (between the border and the checkbox/text). * `CellSpacing` controls the space *between* individual cells. 3. **Browser Compatibility:** The control renders as an HTML `` element with a `cellpadding` attribute, which is widely supported across all modern and legacy web browsers.
← Prop Webcontrol Checkboxlist CProp Webcontrol Checkbox Texta β†’

YouTip © 2024-2026 | Home | Learn Technology, Build Dreams!

All content is for educational and learning purposes only.