سؤال

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>
هل كانت مفيدة؟

المحلول

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>

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top