Button with link in MVC5 is not working

1

I created a popup in an mvc5 project (Razor) and it is not working the link that when I click the button it would go to another page but it is not working I will post the code here below.

Code:

<div id="banner_popup" style="display:none">
    <a href="javascript: void(0);" onclick="fecha_banner();" class="linksFechar">
        <img class="imgfechar" src="~/Images/Popup/fechar.png" border="0">
    </a>
   <a href="@Url.RouteUrl("TornarPagina", new { controller = "HomeController", action = "TornarPagina" })" title="Clique Aqui!">
        <div class="info">
            <h1><span class="linha1">Faça o </span></br><span class="linha2a"> ABC </span><span class="linha2b">do</span><span class="linha2c"> ABC </span></br><span class="linha3">sua página Inicial!</span></h1>
            <div class="button">
                Clique Aqui!
            </div>
        </div>
    </a>
</div>

<script language="JavaScript">
        if(document.getElementById('banner_popup'))
            abre_banner();
</script>

<script>
    $(document).ready(function () {

        var banner = sessionStorage.getItem('banner_popup');
        if (banner != "1") {
            abre_banner();
            sessionStorage.setItem('banner_popup', "1");
        }
    });

    function fecha_banner_timeout() {
        setTimeout(function () {
            fecha_banner()
        }, 10000);
    }

    function abre_banner() {
        var banner_obj = document.getElementById('banner_popup');

        banner_obj.style.left = '';
        banner_obj.style.top = '';  

        banner_obj.style.display = '';

        fecha_banner_timeout();
    }

    function fecha_banner() {
        var banner_obj = document.getElementById('banner_popup');
        banner_obj.style.display = 'none';
    }
</script>

Note: I have already done the controller that is in the HomeController I made an actionResult that returns the view, and the view explains the popup.

    
asked by anonymous 05.07.2016 / 20:45

1 answer

0

You do not need to use @Url.RouteUrl for your case. Use instead @Url.Action :

<a href="@Url.Action("TornarPagina", "Home", new { alt = "Clique Aqui!" })">
   ...

Do not use "Controller" in the Controller name . Only "Home" already resolves correctly.

    
05.07.2016 / 20:54