ASP.Net WebForms中的Twitter Bootstrap`container` div

jab*_*its 2 asp.net webforms twitter-bootstrap

我已经在一个页面上的几个容器Twitter Bootstrap容器中找到了一些container使用信息,但是还是想要更多的输入.

从Twitter Bootstrap自己的例子中,我们container在同一页面上看到多个div.但是ASP.Net MasterPages和UserControls呢?

如果container在主服务器上使用单个服务器,那么将所有内容区域封装在一个顶级服务中container(然后内容页面将包含rowdiv)?或者containerdiv应该下推到内容页面?

更进一步,一个由几个rowdiv 组成的相当复杂的UserControl(.ascx)呢?如果ascx标记有它自己的container,或者以rowdiv 开头,假设包含的页面有一个封闭的container

最后,更一般地说,是否有人有关于何时使用新containerdiv 的经验法则?

The*_*heo 7

我将容器div放在我的母版页中,因为我的所有页面都将使用子页面中的行/跨度.万一我希望我的子页面不使用容器,我只需关闭div标签......

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  </div> <!-- ending the container -->

  <!-- whatever -->

  <div> <!-- the master page ends the container div, so we'll add this instead -->
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

一些有用的bootstrap和asp.net的提示......

单选按钮和复选框. 文本显示在收音机/复选框下方.通过将您的asp.net单选按钮列表控件或类似控件嵌套在具有radiocss类或checkboxcss类的div中,并将RepeatLayout设置为flow来解决此问题.

<div class="radio">
    <asp:RadioButtonList ID="rblFleettype" runat="server" RepeatLayout="Flow">
        <asp:ListItem Selected="True">Item 1</asp:ListItem>
        <asp:ListItem>Item 2</asp:ListItem>
    </asp:RadioButtonList>
</div>
Run Code Online (Sandbox Code Playgroud)

警告错误消息. 可以将许多asp.net控件转换为模板以显示错误文字/标签,然后可以应用于CssClass="alert alert-error"错误标签.但是如果你这样做,它将显示红色错误边界,即使还没有错误.要解决此问题,您可以使用文本/标签的PreRender事件来检查Text属性并查看它是否为空,然后相应地设置Visibility属性.