Reputation: 8043
<div class="jplayer" id="jplayer_@Model["id"]_@od["number"]"></div>
It doesn't insert value but writes exactly what you see. Variables exist because this code work perfectly:
<div class="music_player @Model["id"]"></div>
So what is wrong?
Upvotes: 3
Views: 208
Reputation: 1252
Try:
<div class="jplayer" id="jplayer_@(Model["id"])_@(od["number"])"></div>
It sounds similar to my question: Combining Code and Text in HTML Attribute with Razor
Upvotes: 3
Reputation:
Try this:
<div class="music_player @(Model["id"])"></div>
And
<div class="jplayer" id="jplayer_@(Model["id"])_@(od["number"])"></div>
As per Phil Haack's C# Razor Syntax Quick Reference, you need to enclose your Razor expression in parenthesis with a prefix of the @
.
Upvotes: 1