RadioButtonList Items Vertical Spacing
This is a .net radiobuttonlist tutorial. in this tutorial we see how can we apply big vertical space between
list items. asp.net radiabuttoblist control have no built in property to set up list items vertical spacing.
so we need to apply core css techniques in this issue. in asp.net radiobuttonlist item exists in a table td column.
here we simply setup the table td height property.
radiobuttonlist-vertical-spacing.aspx
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
RadioButtonList1.Items.Add(new ListItem("Asian Glossy Starling", "1"));
RadioButtonList1.Items.Add(new ListItem("Golden Myna", "2"));
RadioButtonList1.Items.Add(new ListItem("Hill Myna", "3"));
RadioButtonList1.Items.Add(new ListItem("Orange-headed Thrush", "4"));
RadioButtonList1.Items.Add(new ListItem("Blue Whistling-thrush", "5"));
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net radiobuttonlist vertical spacing</title>
<style type="text/css">
.radiobuttonlist {
}
.radiobuttonlist td{
height:45px;
vertical-align:middle;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:MidnightBlue; font-style:italic;">
asp.net example - radiobuttonlist vertical spacing
</h2>
<hr width="550" align="left" color="Gainsboro" />
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
Width="350"
Text="select an item from radiobuttonlist....."
>
</asp:Label>
<br /><br />
<asp:RadioButtonList
ID="RadioButtonList1"
runat="server"
RepeatDirection="Vertical"
AutoPostBack="true"
RepeatLayout="Table"
CssClass="radiobuttonlist"
>
</asp:RadioButtonList>
</div>
</form>
</body>
</html>

- How to sort DropDownList items
- How to sort ListBox items
- How to show horizontal ScrollBar in a ListBox
- How to get CheckBoxList checked items
- How to get selected value from RadioButtonList
- How to create a horizontal layout RadioButtonList
- How to perform foreach loop through RadioButtonList items
- How to add different tooltip for RadioButtonList items
- How to add margin between items in a RadioButtonList
- How to set RadioButtonList items vertical alignment