mercredi 15 juillet 2015

Alert not executing when redirected from other page

I have the following code in the body tag of a view in MVC. The problem is that the alert message is displayed on first time loading of the page but it isn't executing when the control is coming through redirect.

Also, I have used the break point to see that the code is executing but it doesn't execute the alert line.

@{

    <script type="text/javascript">
    @if (TempData["notice"] != null)
    {
        @:alert(TempData["notice"]);
    }
    else 
    {
        @:alert("No notice");          
    }
    </script>
}

Aucun commentaire:

Enregistrer un commentaire