Tri
Tri

Reputation: 535

Razor syntax for adding Script into the footer of the layout

I'm trying to remember the Razor syntax in .NET MVC3 to add a block of Javascript codes in a partial view into the footer of the layout. I used it once somewhere which I could not find. I google it but no luck. It goes something like this

@Scripts.Add(@Script.Foot){
<script type="text/javascript">alert("hello everyone");</script>
}

Please help me with the correct this syntax

Thanks in advance

Tri

Upvotes: 2

Views: 3310

Answers (1)

SLaks
SLaks

Reputation: 888203

You're probably trying to write a section:

@section Footer {
    <script type="text/javascript">alert("hello everyone");</script>
}

Upvotes: 2

Related Questions