我有这样的:编码字符串HTML Asp.NET MVC剃刀
@model IEnumerable<MVPTracker.Models.DashboardResult>
@using MVPTracker.Models;
@{
int row = 0;
ViewBag.Title = "DashboardList";
Layout = "~/Views/Shared/_Layout.cshtml";
string top = "<div class='row'> ";
string Bot = "</div> ";
}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="wrapper wrapper-content animated fadeInRight">
@{
foreach (var item in Model)
{
if (row == 0)
{
Html.Encode(top);
}
<div class="col-md-3">
<div class="ibox">
<div class="ibox-content product-box">
<div class="product-imitation">
<img src="~/Images/App/EventHeader.jpg" width="100%" />
</div>
<div class="product-desc">
<span class="product-price">
@Html.DisplayFor(modelItem => item.Sport.Name)
</span>
<a href="@Url.Action("ViewResults", "Results", new { key = Functions.encrypt(item.DashboardResultID.ToString()) })" class="product-name"> @Html.DisplayFor(modelItem => item.EventName)</a>
<div class="small m-t-xs">
<strong>Desc:</strong> @Html.DisplayFor(modelItem => item.Description) <br />
<strong>Date:</strong> @Html.DisplayFor(modelItem => item.EventDate)
</div>
<br />
<div class="m-t text-righ">
<a href="@Url.Action("UploadResults", "Results", new { key = Functions.encrypt(item.DashboardResultID.ToString()) })" class="btn btn-xs btn-outline btn-primary">Upload Results <i class="fa fa-long-arrow-right"></i> </a>
<a href="@Url.Action("ViewResults", "Results", new { key = Functions.encrypt(item.DashboardResultID.ToString()) })" class="btn btn-xs btn-outline btn-primary">View Results <i class="fa fa-long-arrow-right"></i> </a>
</div>
</div>
</div>
</div>
</div>
if (row == 3)
{
Html.Encode(Bot);
row = 0;
}
else
{
row++;
}
}
}
</div>
</div>
</div>
</div>
</div>
我有2个变量有一个div片段,我当行打印开放股利和股利接近已经完整,实际的代码我不能做到这一点,我尝试另一种东西(HTMLString,HTML.Raw ...),但没有任何作品,请你给我一个这样的手?
谢谢!
你想做什么?你有什么尝试? (这没有帮助“我尝试另一种东西(HTMLString,HTML.Raw ...)坚果没有工作”)) – Shyju
在代码的顶部我有这个:string top =“
你想按原样打印它,还是要将HTML呈现在页面中? – Shyju