ASP.NET MVC Razor Url.Action在Internet Explorer 8中不起作用 [英] ASP.NET MVC Razor Url.Action doesn't work in Internet Explorer 8

查看:267
本文介绍了ASP.NET MVC Razor Url.Action在Internet Explorer 8中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Razor开发了一个简单的ASP.NET MVC3项目。在页面之间进行链接,我使用下表:

I developed a simple ASP.NET MVC3 project with Razor. Linking between pages, I use the following table:

<table class="indexTable" align="left">
    <tr>
        <td class="indexTd">
        <a class="noUL" href='@Url.Action("Index", "ProblemEntrance")'><button class="menuButton">@ViewBag.ProblemEntrance</button></a>
        </td>

所以当我点击ProblemEntrance时,它会将我从ProblemEntranceController转到ProblemEntrance Index页面。在Mozilla和Chrome中一切正常,但是使用Internet Explorer,页面保持不变,并且不会对我的点击产生任何反应。知道我能做些什么吗?

So when I click on ProblemEntrance, it takes me from ProblemEntranceController to ProblemEntrance Index page. Everything works fine in Mozilla and Chrome, but with Internet Explorer, the page just stay the same and doesn't give any reaction to my click. Any idea what I can do about it?

推荐答案

href 按钮上的属性,然后挂钩点击处理程序:

Put the href attribute on the button, then hook up a click handler:

<button href='@Url.Action("Index", "ProblemEntrance")' class="menuButton" onclick='location.href=this.getAttribute("href")'>@ViewBag.ProblemEntrance</button>

下面是小提琴

这篇关于ASP.NET MVC Razor Url.Action在Internet Explorer 8中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆