当前位置: 代码迷 >> ASP.NET >> checkboxlist怎么后面紧跟一个textbox
  详细解决方案

checkboxlist怎么后面紧跟一个textbox

热度:6332   发布时间:2013-02-25 00:00:00.0
checkboxlist如何后面紧跟一个textbox?
如题,想实现checkboxlist后面紧跟一个textbox,checkboxlist横向排列,并且设定了每行显示6个(如果是一行就不存在这个问题),肯定会有换行。设定Width也是不行的,这样其实就在是html中加上了 style="display:inline-block;width:600px;"类似这样的css代码,并且会产生列表项中间换行。
C# code
            <asp:CheckBoxList ID="Interest" runat="server" RepeatDirection="horizontal" RepeatLayout="flow">            </asp:CheckBoxList>            <asp:TextBox ID="InterestOther" runat="server" CssClass="input1"></asp:TextBox>


暂时还不想使用html控件,求有没有解决办法

------解决方案--------------------------------------------------------
用个TABLE不设置width
------解决方案--------------------------------------------------------
HTML code
<table><tr><td> <asp:CheckBoxList ID="Interest" runat="server" RepeatDirection="horizontal" RepeatLayout="flow">            </asp:CheckBoxList></td><td>            <asp:TextBox ID="InterestOther" runat="server" CssClass="input1"></asp:TextBox></td></tr></table>
------解决方案--------------------------------------------------------
如果使用的是ASP.NET 4.0 可以使用新属性控制呈现

RepeatDirection="Horizontal" RepeatLayout="Flow"
------解决方案--------------------------------------------------------
明白你意思了,因为checkboxlist会每一行追加一个<br />,所以给checkboxlist设置css像
style="display:inline-block;"
可以达到目的
  相关解决方案