Question

I have a Checkboxlist in my page as follows.

enter image description here

As you can see, the 2 checkboxes are aligned one below the other. Is it possible to bring the 2 on a single line? The design code for this is as follows.

<td>
                     <asp:Label runat="server" ID="Label1" Text="Employer Type"></asp:Label>
                </td>
                        <td valign="middle">
                            <asp:CheckBoxList ID="chkEmployerType" runat="server">
                                <asp:ListItem Value="E" Text="Employer"></asp:ListItem>
                                <asp:ListItem Value="O" Text="OJT Provider"></asp:ListItem>
                            </asp:CheckBoxList>

                        </td>
Was it helpful?

Solution

write this

<asp:Label runat="server" ID="Label1" Text="Employer Type"></asp:Label>
                </td>
                        <td valign="middle">
                            <asp:CheckBoxList ID="chkEmployerType" runat="server"  RepeatDirection="Horizontal">
                                <asp:ListItem Value="E" Text="Employer"></asp:ListItem>
                                <asp:ListItem Value="O" Text="OJT Provider"></asp:ListItem>
                            </asp:CheckBoxList>

                        </td>

OTHER TIPS

Set RepeatDirection property of CheckBoxList to Horizontal

You need to use RepeatDirection property as following

RepeatDirection="Horizontal"

It creates ul and li for displaying item. You can define css rule do display as you like.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top