Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an HTML Action Link to target a div

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!

like image 999
Clive_Bigsby Avatar asked Dec 03 '22 19:12

Clive_Bigsby


1 Answers

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

like image 182
beautifulcoder Avatar answered Dec 30 '22 11:12

beautifulcoder