ASP.NET Web 应用程序中的引导程序问题 [英] Bootstrap in ASP.NET Web Application Issue

查看:47
本文介绍了ASP.NET Web 应用程序中的引导程序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 bootstrap 向我的 Web 应用程序添加一些字形,但之前没有使用过 bootstrap,我不明白我应该怎么做.有很多关于如何做到这一点的令人困惑的文章,我遵循了一些但没有得到任何结果.到目前为止,我已经使用 NuGet 在我的项目中添加了引导程序.

我查看了我的文件,所有依赖项和引用都在那里.但是,当我运行我的项目时,字形仍然没有出现.我在页面下方发布了代码,我想在其中显示这些字形.知道我还需要做什么才能让他们工作吗?

@page@model CustomerPageTest.Pages.Customer.ListModel@{ViewData[标题"] =列表";}<div><p align=右"><a class="btn btn-dark";asp-page=./AddCustomer">添加新客户</p>

<表单方法=获取"><div class="form-group"><div class="input-group"><输入类型=搜索"类=表单控制"asp-for=SearchTerm"/><span class="btn btn-outline-dark"><i class="glyphicon glyphicon-search"></i></span>

</表单><表类=表">@foreach(Model.Customers 中的 var 客户){<tr><td>@customer.name</td><td>@customer.notes</td><td><a class="btn btn-outline-dark";asp-page="/Assessment/AddAssessment";asp-route-customerId =@customer.customer_id"><i class="glyphicon glyphicon-plus"</i></a></td></tr>}

解决方案

你需要把下面的 bootstrap.min.css 文件放到你的页面上才能显示 glyphicon.

@page@model CustomerPageTest.Pages.Customer.ListModel@{ViewData["Title"] = "List";}<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"><div><p align="right"><a class="btn btn-dark"asp-page="./AddCustomer">添加新客户</a></p>

<表单方法=获取"><div class="form-group"><div class="input-group"><input type="search" class="form-control" asp-for="SearchTerm"/><span class="btn btn-outline-dark"><i class="glyphicon glyphicon-search"></i></span>

</表单><table class="table">@foreach(Model.Customers 中的 var 客户){<tr><td>@customer.name</td><td>@customer.notes</td><td><a class="btn btn-outline-dark"asp-page="/Assessment/AddAssessment" asp-route-customerId ="@customer.customer_id"><i class="glyphicon glyphicon-plus"></i></a></td></tr>}</table>

I'm trying to add some glyphicons to my web applications through bootstrap, but haven't used bootstrap before and I don't understand how I'm supposed to be doing this. There are a lot of confusing articles on how to do this, and I followed a few but haven't gotten any results. So far, I have added bootstrap into my project using NuGet.

I looked through my files and all the dependencies and references are there. However, when I run my project, the glyphicons still don't show up. I've posted the code below of the page where I want to show these glyphicons. Any idea on what more I have to do to get them to work?

@page
@model CustomerPageTest.Pages.Customer.ListModel
@{
    ViewData["Title"] = "List";
}

<div>
    <p align="right">
        <a class="btn btn-dark"
           asp-page="./AddCustomer">Add New Customer</a>
    </p>
</div>

<form method="get">
    <div class="form-group">
        <div class="input-group">
            <input type="search" class="form-control" asp-for="SearchTerm" />
            <span class="btn btn-outline-dark">
                <i class="glyphicon glyphicon-search"></i>
            </span>
        </div>
    </div>
</form>

<table class="table">
    @foreach(var customer in Model.Customers)
    {
        <tr>
            <td>@customer.name</td>
            <td>@customer.notes</td>
            <td>
                <a class="btn btn-outline-dark"
                   asp-page="/Assessment/AddAssessment" asp-route-customerId ="@customer.customer_id">
                    <i class="glyphicon glyphicon-plus"></i> 
                </a>
            </td>
        </tr>
    }
</table>

解决方案

You need to put below bootstrap.min.css file on to your page to display glyphicon.

@page
@model CustomerPageTest.Pages.Customer.ListModel
@{
    ViewData["Title"] = "List";
}
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> 
<div>
    <p align="right">
        <a class="btn btn-dark"
           asp-page="./AddCustomer">Add New Customer</a>
    </p>
</div>

<form method="get">
    <div class="form-group">
        <div class="input-group">
            <input type="search" class="form-control" asp-for="SearchTerm" />
            <span class="btn btn-outline-dark">
                <i class="glyphicon glyphicon-search"></i>
            </span>
        </div>
    </div>
</form>

<table class="table">
    @foreach(var customer in Model.Customers)
    {
        <tr>
            <td>@customer.name</td>
            <td>@customer.notes</td>
            <td>
                <a class="btn btn-outline-dark"
                   asp-page="/Assessment/AddAssessment" asp-route-customerId ="@customer.customer_id">
                    <i class="glyphicon glyphicon-plus"></i> 
                </a>
            </td>
        </tr>
    }
</table>

这篇关于ASP.NET Web 应用程序中的引导程序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
C#/.NET最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆