【问题标题】:How to always show buttons on bottom left (ASP.NET Core with Bootstrap)如何始终在左下角显示按钮(带有 Bootstrap 的 ASP.NET Core)
【发布时间】:2017-10-22 00:02:54
【问题描述】:

我有一个 ASP.NET Core Web 应用程序,有两个按钮可以实现搜索结果导航。我想弄清楚如何总是在左下角显示按钮。我怎样才能轻松做到这一点?

这是一张图片。 https://i.stack.imgur.com/uyWwE.png

这是代码。

var prevDisabled = !Model.HasPreviousPage ? "disabled" : ""; 
var nextDisabled = !Model.HasNextPage ? "disabled" : "";

<a asp-action="Index" 
asp-route-sortOrder="@ViewData["CurrentSort"]" 
asp-route-page="@(Model.PageIndex - 1)" asp-route-currentFilterSearchBy="@ViewData["CurrentFilterSearchBy"]" currentFilterLocation="@ViewData["CurrentFilterLocation"]"
asp-route-currentFilterItem="@ViewData["CurrentFilterItem"]"
class="btn btn-default @prevDisabled" style="bottom:0;">
Previous
</a>
<a asp-action="Index"
asp-route-sortOrder="@ViewData["CurrentSort"]"
asp-route-page="@(Model.PageIndex + 1)"
asp-route-currentFilterSearchBy="@ViewData["CurrentFilterSearchBy"]"
asp-route-currentFilterLocation="@ViewData["CurrentFilterLocation"]"
asp-route-currentFilterItem="@ViewData["CurrentFilterItem"]"
class="btn btn-default @nextDisabled" style="bottom:0;">
Next
</a>

【问题讨论】:

    标签: asp.net razor bootstrap-4


    【解决方案1】:

    你创建了bootstrap的网格系统吗? 您需要将 next 作为示例:

    <div class="container">
        <div class="row">
            <div class="col-1">
                <div>CARD</div>
                <div>
                    <a asp-action="Index" 
                        asp-route-sortOrder="@ViewData["CurrentSort"]" 
                        asp-route-page="@(Model.PageIndex - 1)" asp-route-currentFilterSearchBy="@ViewData["CurrentFilterSearchBy"]" currentFilterLocation="@ViewData["CurrentFilterLocation"]"
                        asp-route-currentFilterItem="@ViewData["CurrentFilterItem"]"
                        class="btn btn-default @prevDisabled" style="bottom:0;">
                        Previous
                    </a>
                    <a asp-action="Index"
                        asp-route-sortOrder="@ViewData["CurrentSort"]"
                        asp-route-page="@(Model.PageIndex + 1)"
                        asp-route-currentFilterSearchBy="@ViewData["CurrentFilterSearchBy"]"
                        asp-route-currentFilterLocation="@ViewData["CurrentFilterLocation"]"
                        asp-route-currentFilterItem="@ViewData["CurrentFilterItem"]"
                        class="btn btn-default @nextDisabled" style="bottom:0;">
                        Next
                    </a>
                </div>
            </div>
            <div class="col-5">
                CONTENT
            </div>
        </div>
    </div>
    

    【讨论】:

    • 没有正确使用。 :-) 你太棒了——工作得很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-23
    • 1970-01-01
    • 2011-06-09
    • 1970-01-01
    • 2023-03-19
    • 2019-05-04
    • 2016-09-16
    相关资源
    最近更新 更多