gpt4 book ai didi

c# - MVC Web 应用程序包和脚本、样式呈现

转载 作者:太空宇宙 更新时间:2023-11-03 19:03:08 24 4
gpt4 key购买 nike

我正在开发一个网络应用程序并且我有这个Bundle Config

using System.Web;
using System.Web.Optimization;

namespace WebApplication3
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/WebFormsJs").Include(
"~/Scripts/WebForms/WebForms.js",
"~/Scripts/WebForms/WebUIValidation.js",
"~/Scripts/WebForms/MenuStandards.js",
"~/Scripts/WebForms/Focus.js",
"~/Scripts/WebForms/GridView.js",
"~/Scripts/WebForms/DetailsView.js",
"~/Scripts/WebForms/TreeView.js",
"~/Scripts/WebForms/WebParts.js"));

bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Include(
"~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"));

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));

}
}
}

这是我的查看页面之一:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
<-- This?? -->
</script>

我怎样才能渲染这些包?我正在使用使用 asp.net aspx View 的 Asp.net Web 应用程序

最佳答案

您用于 MVC:

@Scripts.Render("~/bundles/WebFormsJs")

对于 WebForms:

<%: Scripts.Render("~/bundles/WebFormsJs") %> 

关于c# - MVC Web 应用程序包和脚本、样式呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32731896/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com