How to add model value to the html attribute value

asp.net-mvc, asp.net-mvc-3

Solution

try this (basically adding parenthesis around the property):

<input type="checkbox" name="option2" id="tech_
@(technologyName.TechnologyID)"  value="@technologyName.TechnologyID" />

Problem

I have this code ``` @if (ViewBag.TechnologyNames != null) { foreach (var technologyName in ViewBag.TechnologyNames) { if (@technologyName.TechnologyID == -1) { <div class="CheckBoxItem"> <input type="checkbox" name="option1" id="allTechnology" value="@technologyName.TechnologyID" checked="checked" /> @technologyName.Name </div> } else { <input type="checkbox" name="option2" id="tech" value="@technologyName.TechnologyID" /> @technologyName.Name } } } ``` What I need is somehow to add `@technologyName.TechnologyID` to `id="tech"` to have at the end ``` id="tech_123" ``` How I can do it? Thank you!

Original source