Linking Between View

We want to link the view between our index and detail view of the selected comic book.

Back to our index.cshtml file. The idea is using ActionLink() function when the text was clicked and route it to Detail view with "ID" parameter thrown.

@foreach (var comicBook in Model)
{
    <div class="col-md-3">
        <h4>@Html.ActionLink(comicBook.DisplayText, "Detail",  new { id = comicBook.Id })</h4>
        <h4>@comicBook.DisplayText</h4>
        <img src="/Images/@comicBook.CoverImageFileName"
             alt="@comicBook.DisplayText"
             class="img-responsive" />
    </div>
}

It is not done yet. We want to be able to click at the image. Unfortunately, we couldn't do the same approach as above.

Now, the idea is wrap the image within anchor <a> tag and direct the image to certain url link.

<a href="@Url.Action("Detail", new { id = comicBook.Id })">
     <img src="/Images/@comicBook.CoverImageFileName"
          alt="@comicBook.DisplayText"
          class="img-responsive" />
 </a>

results matching ""

    No results matching ""