Jakob Gade
Jakob Gade

Reputation: 12419

Concatenate tag attribute value using Razor and a prefix

How do I do this in Razor (VB.NET):

<div class="[email protected]">

If @ViewBag.MyValue is "xxx", the output should be

<div class="some_prefix_xxx">

Upvotes: 9

Views: 3002

Answers (1)

Ethan Cabiac
Ethan Cabiac

Reputation: 4993

Use parentheses:

<div class="some_prefix_@(ViewBag.MyValue)">

Upvotes: 18

Related Questions