【问题标题】:How to import bootstrap in visual studio sharepoint/office webpart?如何在 Visual Studio Sharepoint/Office Webpart 中导入引导程序?
【发布时间】:2020-06-16 17:42:37
【问题描述】:

我在 Visual Studio 中创建了一个 SharePoint webpart,我想在 webpart 中使用引导程序。如何在 webpart 中导入或链接引导程序?

<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdminDashBoardUserControl.ascx.cs" Inherits="Portal_Webparts.AdminDashBoard.AdminDashBoardUserControl" %>

<%-- Here i was tring to link it but i dont know if its the way its done. After creating the webpart this is only what i did--%>

<%@ Import importableModuleLoader from '@microsoft/sp-module-loader'; %>
<%@ Import importableModuleLoader.loadCss('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css') %>

【问题讨论】:

    标签: c# sharepoint bootstrap-4 web-parts


    【解决方案1】:

    要在您的 webpart 中引用引导 css,请尝试。

    <style type='text/css'>    
    @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css");
     </style>
    

    【讨论】:

    • 我尝试使用您提供的链接进行引用并放置了一个导航栏,此错误显示在页面顶部Error loading navigation: TermStore not found (Correlation ID: c3c03b9f-4548-408c-9d8b-8345355ea085) 并且没有任何内容。
    • 与您的 webpart 逻辑相关的错误,不是由引导程序引起的,请查看 ULS 日志以获取详细错误。
    • 我没有在你的 webpart 中看到任何内容,所以它会呈现为空白,引导程序只需将 CSS 应用到你的 HTML DOM,你可以将示例文本或 div/p 等内容插入到你的webpart 检查 webpart 渲染。
    • 我知道我做错了什么谢谢。导入js文件会不会一样
    猜你喜欢
    • 2021-08-27
    • 2011-03-02
    • 2015-05-12
    • 2012-08-30
    • 1970-01-01
    • 2011-03-29
    • 2014-02-21
    • 2015-10-11
    • 2023-03-03
    相关资源
    最近更新 更多