Showing posts with label RadioButton. Show all posts
Showing posts with label RadioButton. Show all posts

Monday, August 23, 2010

How to use TextAlign (text align left right) in RadioButtonList




RadioButtonListTextAlign.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
RadioButtonList1.TextAlign = TextAlign.Left;
}
protected void Button2_Click(object sender, System.EventArgs e)
{
RadioButtonList1.TextAlign = TextAlign.Right;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to use TextAlign (text align left right) in RadioButtonList</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy">RadioButtonList: Change TextAlign</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
ForeColor="DarkOrange"
Text="Color List"
>
</asp:Label>
<asp:RadioButtonList
ID="RadioButtonList1"
runat="server"
BackColor="DarkOrange"
ForeColor="Snow"
Font-Bold="true"
>
<asp:ListItem>DodgerBlue</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
<asp:ListItem>FireBrick</asp:ListItem>
<asp:ListItem>GreenYellow</asp:ListItem>
<asp:ListItem>Crimson</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button
ID="Button1"
runat="server"
Font-Bold="true"
ForeColor="DarkOrange"
Text="TextAlign Left"
OnClick="Button1_Click"
/>
<asp:Button
ID="Button2"
runat="server"
Font-Bold="true"
ForeColor="DarkOrange"
Text="TextAlign Right"
OnClick="Button2_Click"
/>
</div>
</form>
</body>
</html>