Sorry, I must have copied the wrong code to the forum. You have to get the state of the "Page" value into a variable because "i" is 3 when the loops ends.
@for (int i = 0; i < images.Count; ++i)
{
string tempImageName = images[i].Page;
<img src=@($"/Images/{images[i].Image}")
style="left:auto; margin-left:10px; width:200px; cursor:pointer"
@onclick="() => NavigateToNewPage(tempImageName)" />
}
Title not shown and click event on picture not to the page.
There's no "title" in your original code. I'm not sure where "title" should be located. If it is the title attribute of the img element then simply add the attribute like you're doing with the src attribute.
@for (int i = 0; i < images.Count; ++i)
{
string tempImageName = images[i].Page;
<img src=@($"/Images/{images[i].Image}")
style="left:auto; margin-left:10px; width:200px; cursor:pointer"
title=@($"{images[i].Title}")
@onclick="() => NavigateToNewPage(tempImageName)" />
}
To deal with the three images per line within the for...loop.
int tempI = i;
@if (((tempI + 1) % 3) == 0)
{
<br />
}