【问题标题】:Why Bootstrap CSS class table-striped not working in asp.net?为什么 Bootstrap CSS 类 table-striped 在 asp.net 中不起作用?
【发布时间】:2019-07-16 11:37:44
【问题描述】:

我是 Asp.net 和引导程序的新手。我在我的 html 中引用了 bootstrap.min.css 并且我有 gridview 控件,我想用“table table-striped”类设置样式。 Visual Studio intelisens 似乎无法识别 table-striped 类,并且在程序运行时它不起作用。任何想法我做错了什么? 这是我的html源代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NotDelivered.aspx.cs" Inherits="PapaBobs.NotDelivered" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server" class ="container">
        <div class ="form-group">
            <asp:GridView ID="notDeliveredGrid" runat="server" CssClass ="table table-hover table-striped"></asp:GridView>
        </div>
    </form>
    <script src="Scripts/bootstrap.min.js"></script>
    <script src="Scripts/jquery-3.3.1.min.js"></script>
</body>
</html>

【问题讨论】:

    标签: c# css asp.net twitter-bootstrap


    【解决方案1】:

    您当前的 href 值指定了 css 文件的相对路径,浏览器无法加载它,因为该路径不存在。更新以下链接

    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    

    还可以考虑使用bundling

    【讨论】:

    • 感谢您的回答。问题是,例如,我对“无边框”没有任何问题,它可以正常工作。 Intelisense 显示它和一堆其他与表格相关的 CSS 类没有问题,但“table-striped”不在列表中,当我自己输入时,它似乎对最终工作没有影响
    猜你喜欢
    • 2019-04-15
    • 2014-08-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-24
    • 2018-03-06
    • 1970-01-01
    • 2015-12-06
    • 2017-01-22
    相关资源
    最近更新 更多