在asp.net mvc

时间:2018-03-05 09:16:03

标签: asp.net-mvc razor

我在Razor语法中有2个for循环,我想在一个块中实现每个循环,我将样式块添加到第二个for循环但是它与第一个循环的第一行内容一起显示内联

<div style="display:block;">
    @foreach (var Item in Model)
    {
        <div class="col-sm-3">
            <div class="content">
                <p>@Item.Name</p>
            </div>
        </div>
    }
    <br>
</div>

// the page buttons appear next to @Item.Name (at the first line of the loop items) not after it
<div style="display:block;">
    @for (int i = 1; i <= ViewBag.TotalPages; i++)
    {
        <button class="btn btn-info" type="button" id="addressSearch" onclick="location.href='@Url.Action("myaction","mycontroller", new { page = i } )'">@i</button>
    }
</div>

1 个答案:

答案 0 :(得分:0)

如果在外部样式表

中不重要,这应该有效