Center RadioButtonList inside a panel

user1155383 picture user1155383 · Jan 18, 2012 · Viewed 9.4k times · Source

I cannot seem to be able to center my RadioButtonList inside a panel. It always seems to e left justified. No matter what I try.

My current code is:

<asp:panel ID="Panel1" runat="server" CssClass="style8" Height="228px" 
  width="456px">
  <br /> 
         <p style ="text-align:center">
              <asp:Label ID+"Label2" runat="server" Text="Blah">
              </asp:Label>
        </p>
        <asp:RadioButtonList ID="AlertClients" runat="Server" TextAlign="Right" 
       style="list-style=center">
              <asp:ListItem> Option 1</asp:ListItem>
             <asp:ListItem> Option 2</asp:ListItem>
             <asp:ListItem> Option 3</asp:ListItem>
         </asp:RadioButtonList>
</asp:Panel>

Any help would be much appreciated.

Answer

Tapas Mahata picture Tapas Mahata · Jan 18, 2012

Just put this tag in your Radio Button List control: align="center"

<asp:RadioButtonList ID="AlertClients" runat="Server" TextAlign="Right" Style="list-style=center" align="center">
 <asp:ListItem> Option 1</asp:ListItem>
 <asp:ListItem> Option 2</asp:ListItem>
 <asp:ListItem> Option 3</asp:ListItem></asp:RadioButtonList>