日期:2014-05-18  浏览次数:20741 次

請教一個問題,有關于設置CheckBoxList子項之間的間距?
格式例如:
□系統管理
  □用戶管理□角色管理□模塊管理□權限管理

以上格式用戶管理和角色管理..子項之間的間距怎么設置?
請高手教我!

------解决方案--------------------
HTML code

<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
            Width="400px">
            <asp:ListItem>用戶管理</asp:ListItem>
            <asp:ListItem>角色管理</asp:ListItem>
            <asp:ListItem>模塊管理</asp:ListItem>
            <asp:ListItem>權限管理</asp:ListItem>
        </asp:CheckBoxList>

------解决方案--------------------
接分 顶楼上
------解决方案--------------------
只能通过Width设置,如果想精确

建议用html就可以精确设置每个chechbox的位置了
------解决方案--------------------
我自己测试了一下,基本上不太可能做到精确的定位,会根据你的文字多少来自动处理间距的
如果你需要很精确的去控制,那就分解成多个控件然后根据html的Table来进行控制把,不过这样程序会麻烦些
------解决方案--------------------
帮顶~!
------解决方案--------------------
HTML code

<asp:CheckBoxList ID="CheckBoxList1" runat="server" CellPadding="10" CellSpacing="10" RepeatDirection="Horizontal">
            <asp:ListItem>1</asp:ListItem>
            <asp:ListItem>2</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
        </asp:CheckBoxList>

------解决方案--------------------
用CSS代码来控制就OK了啊。。

生成的都是input type这样子的代码,直接添加样式:

div input
{
margin: 0 5px;
}

用一个div把checkboxlist框住。。

楼上的可能更简单
------解决方案--------------------
.
------解决方案--------------------
若不是精确的间隔设置,可以加空格实现
C# code

<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal">
            <asp:ListItem>用戶管理用</asp:ListItem>
            <asp:ListItem>角色管理&nbsp;&nbsp;</asp:ListItem>
            <asp:ListItem>模塊管理&nbsp;&nbsp;</asp:ListItem>
            <asp:ListItem>權限管理&nbsp;&nbsp;</asp:ListItem>
        </asp:CheckBoxList>

------解决方案--------------------
6楼正解,没注意有这个属性