在asp.net mvc中显示块不工作Razor

问题描述 投票:0回答:1

我在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>
asp.net-mvc razor
1个回答
0
投票

如果在外部样式表中不重要,这应该有用

© www.soinside.com 2019 - 2024. All rights reserved.