【问题标题】:ASP.NET MVC Razor Url.Action doesn't work in Internet Explorer 8ASP.NET MVC Razor Url.Action 在 Internet Explorer 8 中不起作用
【发布时间】:2012-11-21 17:14:12
【问题描述】:

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

<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 索引页面。在 Mozilla 和 Chrome 中一切正常,但在 Internet Explorer 中,页面保持不变,对我的点击没有任何反应。知道我能做些什么吗?

【问题讨论】:

    标签: asp.net-mvc-3 internet-explorer razor internet-explorer-8 url.action


    【解决方案1】:

    href 属性放在按钮上,然后连接一个点击处理程序:

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

    这是fiddle

    【讨论】:

      猜你喜欢
      • 2014-04-19
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-19
      • 2011-09-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多