【发布时间】:2015-09-21 05:53:11
【问题描述】:
我试图展示我的产品的一些细节 (shoes=zapatillas) 在 Visual Studio 2013 c# mvc 上 好的,让我们开始使用代码... 这是我在 HomeController 上的索引网页的一部分 http://pastebin.com/VRMb85Qf
这是我的 Producto.cs http://pastebin.com/a2H1ifZT
这是我的 index.cshtml,我想在其中放置一些详细信息,我的问题是,如何在 PRICE、MODEL、INFO 所在的 html 中调用我的 sql 详细信息 看看@zap 失败代码,是这样的吗? 开
ON THE TOP PAGE @using La_esquina_del_calzado1.Models;
in the body...
@foreach (Producto zap in ViewBag.lstProductos)
{ @zap.getid()
@zap.getmodelo()
@zap.getcolor()
}
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/320x150" alt="">
<div class="caption">
<h4 class="pull-right">PRICE</h4>
<h4>
<a href="#">MODEL</a>
</h4>
<p>INFO</p>
</div>
</div>
</div>
【问题讨论】:
-
您到底想做什么?你想在标签中显示 ZAP 的数据吗?
-
是的!我想这样做,它会返回 sql 数据库表对吗?
-
您可以使用@Html.Raw 来显示任何数据