How can I include css files from an MVC partial control?

后端 未结 9 1615
南笙
南笙 2020-12-28 09:15

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

9条回答
  •  难免孤独
    2020-12-28 09:33

    Depending on how much CSS / JS your control needs, the safest route may be just to include the extra styling in your main CSS files. Saves an extra trip to the server, and it should all be cached by the client. I know this kills the self-containedness (to coin a phrase) of the control, but it may be your best bet.

提交回复
热议问题