How to add model value to the html attribute value

Viewed 8829

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!

1 Answers
Related