Using an HTML Action Link to target a div

asp.net-mvc, html, razor

Solution

Possible duplicate. I'll add a bit of explanation that pertains to the question since it has to do with Razor:

What your backend developer needs is `Url.Action` helper. This will let you route the link through the MVC framework.

So say:

<div class="col-md-2">
    <a href="@Url.Action("Cars", "Ambulance")">
        <div class="amb item">
            <div class="tiletext">AMB</div>
            <div class="tilesubtext">Ambulance</div>
        </div>
    </a>
</div>

ASP.NET MVC: generating action link with custom html in it

Problem

I am new to ASP/MVC and I am having trouble figuring out how to link a `div` to a page in HTML markup. This is the current link in pure HTML. I want to accomplish this, but in razor syntax ``` <div class="col-md-2"> <a href="ambulance.html"> <div class="amb item"> <div class="tiletext">AMB</div> <div class="tilesubtext">Ambulance</div> </div> </a> </div> ``` I've been looking into action links, but if there is a better way to accomplish this, I'm open to it!

Original source

Related problems