Obsivus
Obsivus

Reputation: 8359

MVC - Redirect to another view by click on image with jQuery?

I am using MVC.

I have this line in my html:

<div id="logo"><a href="#"><img src="../../Content/img/logo3.png" alt="" /></a></div

But I want to redirect to another view when a user click on the logo.

How can I do that? I need the same structure.

Thanks in advance

Upvotes: 0

Views: 13024

Answers (2)

swapneel
swapneel

Reputation: 3061

<a href="<%: Url.Content("~/Controllor/View") %>">
                <div id="logo">
                </div>
 </a>

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039150

Give your anchor an href value pointing to the controller action that you want to redirect to:

<div id="logo">
    <a href="@Url.Action("someaction", "somecontroller")">
        <img src="../../Content/img/logo3.png" alt="" />
    </a>
</div>

Upvotes: 12

Related Questions