我怎样才能包括从MVC部分控制css文件? [英] How can I include css files from an MVC partial control?

查看:118
本文介绍了我怎样才能包括从MVC部分控制css文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET MVC和我有一个需要特定CSS和功放部分的控制; JS文件包括在内。有没有办法让父页面呈现脚本页面的头部分链接标签,而不是仅仅使它们内嵌在部分控逆变?

I'm using ASP.NET MVC and I have a partial control that needs a particular CSS & JS file included. Is there a way to make the parent page render the script and link tags in the 'head' section of the page, rather than just rendering them inline in the partial contol?

要澄清的是,我想从正在从一个视图与渲染 Html.RenderPartial 包含的文件,因此不能有它的服务器端内容控件。我希望能够在HTML文件部分,从而避免验证问题。

To clarify the control that I want to include the files from is being rendered from a View with Html.RenderPartial and so cannot have server-side content controls on it. I want to be able to include the files in the html head section so as to avoid validation issues.

推荐答案

<一个href=\"http://www.$c$cproject.com/Articles/38542/Include-Stylesheets-and-Scripts-From-A-WebControl-.aspx\" rel=\"nofollow\">http://www.$c$cproject.com/Articles/38542/Include-Stylesheets-and-Scripts-From-A-WebControl-.aspx

此文章包含有关覆盖HttpContext.Response.Filter这对我来说很好工作的信息。

This article contains information about overriding HttpContext.Response.Filter which worked great for me.

这篇关于我怎样才能包括从MVC部分控制css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆