1

This should be dead easy. How do you center a radiobuttonlist? It didn't used to be hard. The below HTML does not work. What am I missing?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table style="width:100%">
                  <tr>
                      <td  style="text-align: center">
                          <asp:RadioButtonList ID="radUserType" runat="server" 
                              RepeatDirection="Horizontal">
                          </asp:RadioButtonList>
                      </td>
                  </tr>
           </table>
    </div>
    </form>
</body>
</html>
user1577821
  • 221
  • 1
  • 4
  • 8

2 Answers2

1

RepeatLayout="Flow"

Renders the RadioButtonList in a span rather than a table.

Joe
  • 49
  • 6
0

Try using td attributes :

<td align="center"> 
      <asp:RadioButtonList ID="radUserType" runat="server" 
       RepeatDirection="Horizontal">
       </asp:RadioButtonList>
</td>
ygssoni
  • 7,219
  • 2
  • 23
  • 24
  • Yes, that works in this example, but not on my page, which uses CSS. It seems as if some CSS attribute up the line is overriding the "align=center". So, it would seem the remedy would be to add a CSS style directly in the cell. Shouldn't that be used before other up-line CSS? – user1577821 Sep 07 '12 at 15:03
  • Using Chrome. If I use

    , it renders as centered in VS2010, but when I view in the browser, it's back to left justify.

    – user1577821 Sep 07 '12 at 15:13
  • Viewing the page, radiobuttonlist LEFT justified, hwere is the source HTML. This makes no sense.

    – user1577821 Sep 07 '12 at 15:18