You've missed the double quotes it should be:
<img src="@parameterValue" height="180" />
Pergunta
I am trying to create a view with a list of images. This is my code:
<ul class="gallery">
@foreach (string item in Model)
{
<li>
@{
string parameterValue = "/PhotoGallery/" + item.ToString();
}
<img src=@parameterValue height="180" />
</li>
}
</ul>
I have problems when the file name contains space. Example:
<li>
<img src=/PhotoGallery/DSC_0901.JPG height="180" />
</li>
<li>
<img src=/PhotoGallery/name with space.jpg height="180" />
</li>
I get the error:NetworkError: 404 Not Found - http:// localhost:6538/PhotoGallery/name
Solução
You've missed the double quotes it should be:
<img src="@parameterValue" height="180" />