Hi,
The problem is: If you put the full variable as an attribute value, you should resolve the full URL yourself in
imageSource1
and
imageSource2
.
Else, you can do the workaround (note that "~/" is moved to attribute value):
<div class="js-container-assortmentlist">
@{
string layoutImage1 = "FORMULE1UNTIL3_MOBIELETAFEL1_A_SIDE.jpg";
string layoutImage2 = "FORMULE1UNTIL3_MOBIELETAFEL1_B_SIDE.jpg";
string imageSource1 = "images/TafelLayouts/" + layoutImage1;
string imageSource2 = "images/TafelLayouts/" + layoutImage2;
}
<div style="width:30%; margin-left: auto;margin-right: auto;display:block " id="layoutImage1">
<img class="" id="imgLayout" src="~/@imageSource1" alt="@layoutImage1">
</div>
<div style="width:30%; margin-left: auto;margin-right: auto;display:none " id="layoutImage2">
<img class="" id="imgLayout" src="~/@imageSource2" alt="@layoutImage2">
</div>
<br />
</div>