YouTip LogoYouTip

Prop Webcontrol Radiobuttonlist Cellspacing

## ASP.NET RadioButtonList CellSpacing Property The `CellSpacing` property is a member of the `RadioButtonList` control in ASP.NET Web Forms. It is used to get or set the spacing (in pixels) between individual cells in the rendered table layout of the radio button list. --- ### Definition and Usage The `CellSpacing` property defines the amount of space between the cells of the table that contains the radio buttons. > **Important Note:** This property is only effective when the `RepeatLayout` property of the `RadioButtonList` is set to `RepeatLayout.Table` (which is the default layout behavior). If `RepeatLayout` is set to `Flow`, `UnorderedList`, or `OrderedList`, this property will be ignored because no HTML `` element is generated. --- ### Syntax ```xml ``` #### Property Values | Value | Description | | :--- | :--- | | `pixels` | An integer representing the number of pixels of space between the table cells. | --- ### Code Example The following example demonstrates how to set the `CellSpacing` property to `15` pixels to create visible separation between the radio button options. #### ASPX Markup: ```xml <%@ Page Language="C#" %> RadioButtonList CellSpacing Example

RadioButtonList with CellSpacing="15"

``` --- ### Key Considerations 1. **Layout Dependency**: Always ensure `RepeatLayout` is set to `Table` (or left omitted, as it defaults to `Table`) when using `CellSpacing`. 2. **CellPadding vs. CellSpacing**: * `CellSpacing` controls the space *between* adjacent cells. * `CellPadding` controls the space between the *cell border* and the *cell content* (the radio button and its label). 3. **Modern Web Standards**: While `CellSpacing` is a quick way to style layout in legacy Web Forms applications, modern web development often favors using CSS (e.g., `gap` in Flexbox/Grid or `margin` on list items) combined with `RepeatLayout="Flow"` or `RepeatLayout="UnorderedList"` for cleaner, responsive HTML output.
← Prop Webcontrol RadiobuttonlisProp Webcontrol Radiobuttonlis β†’

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

All content is for educational and learning purposes only.