5

I love Bootstrap, and I love MVC 3 and MVC 4, however even though I see plenty of Bootstrap examples I'm not really seeing example on using Bootstrap with MVC3 with tabular data in a grid like system.

Any examples anywhere?

  1. I do not want to use Telerik, KendoUI, or many of these other things
  2. Really not thrilled with the "WebGrid" as I would prefer to stay away from tables

So any solid thoughts on Bootstrap with Razor View Engine, and how about avoiding the use of tables?

4

1 回答 1

1

你必须考虑这个有点不同。所有 twitter bootstrap 给你的只是一堆样式。

1.  <table class="table table-bordered">
2.    …
3.  </table>

如果您使用 ASP.NET MVC Razor、Angular.JS、Knockout.js、Handbar.js 或任何允许您获取数据并以编程方式创建动态 html 的工具,则必须根据语言的语法进行设置。

@Model List<string>

<table class="table table-bordered">
      @foreach(var item in @Model){
        <tr>
          <td>@item</td>
       </tr>
      }
</table>

Bootstrap 只为您提供了一个通用的可重用样式库。某些 HTML 必须以某种方式进行布局才能使样式正确运行,但这是设计使然,应参考文档 @ http://twitter.github.io/bootstrap/index.html以获得更多帮助.

于 2013-07-02T16:54:30.337 回答