Search code examples
asp.netcenterradiobuttonlistlistitem

Center RadioButtonList inside a panel


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.


Solution

  • 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>