Failing to render squishit bundal

93 views Asked by At

If I have a partial view, named: _jquery.cshtml, view like so:

@(Bundle.JavaScript()
.Add("~/Scripts/jquery-3.1.0.js")
.Add("~/Scripts/jquery-ui.js")
)

and render the partial view, using:

<head>
...
@Html.Partial("_jquery", theme)
</head>
<body>
...
</body>

all I get rendered is:

<head>
...
</head>
<body>
SquishIt.Framework.JavaScript.JavaScriptBundle

I am doing something wrong obviously. This is inside an IFrame, within the main Layout. I would be grateful if someone is able to point out my problem. Thank You.

1

There are 1 answers

0
Rusty Nail On BEST ANSWER

Always when learning a new, not so new anymore, thing, it takes some time. I missed the line:

.MvcRender("~/.../filename.js")

It is now rendering as it should. so the partial view now looks like this:

@(Bundle.JavaScript()
   .Add("~/Scripts/jquery-3.1.0.js")
   .Add("~/Scripts/jquery-ui.js")
   .MvcRender("~/.../filename.js")
)

I hope others can learn from my mistake.