Depending on how you want to implement it (if there was a specific location in which you wanted to use scripts), you could implement @section in your _Layout , which will allow you to add additional scripts from the view itself, while preserving the composition. eg.
_layout
<!DOCTYPE html> <html> <head> <title>...</title> <script src="@Url.Content("~/Scripts/jquery.min.js")"></script> @RenderSection("Scripts",false/*required*/) </head> <body> @RenderBody() </body> </html>
View
@model MyNamespace.ViewModels.WhateverViewModel @section Scripts { <script src="@Url.Content("~/Scripts/jqueryFoo.js")"></script> }
Otherwise, you are fine. If you don't mind that it is βinlineβ with the view displayed, you can put a <script> declaration in the view.
Brad Christie Jan 11 '13 at 18:52 2013-01-11 18:52
source share