本文介绍了按钮标记在IE7中不起作用(使用asp.net mvc)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有这个ASP.net MVC项目,该项目需要界面之类的向导...因此,我正在使用表单内的下一个后退按钮.

I have this ASP.net MVC project that requires a wizard like interface...So I am using the next ,back button inside the form.

我正在将按钮名称捕获在控制器中,以执行所需的操作.

And I am trapping the button name in my controller to do the required action.

但是问题是按钮单击在IE8,chrome,ff中有效,但在IE7中无效.

似乎没有触发回发...我是否必须在Onclick上明确触发回发?任何人都知道为什么在IE7中按钮单击不触发吗?

It doesnt seem to fire the postback...do I have to explicity fire the postback on Onclick?Anyone knows why button click not firing in IE7 ???

谢谢我的回答.

这是我正在使用的伪代码...

Here's the psuedo code I am using...

<% using (Html.BeginForm("ListEntries","Home",FormMethod.Post, new { @Id = "MyForm" } )) {%>
                        <button name="button" value="next">Next</button>
                        <button name="button" value="back">Back</button>
  //blah....blh...blah...


<% } %>

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult ListEntries( string button)
    {
        if (button == "next")
            return RedirectToAction("doNextAction");
    else
    if (button == "back")
    return RedirectToAction("goBack");

}

推荐答案

此链接 http://www.peterbe.com/plog/button-tag-in-IE 让我相信,在IE7中,button元素不会将单个字符串发布到您的控制器,因此不会匹配您的控制器的签名方法,您是否尝试过(如此处建议的那样)使用类型为Submit的输入元素代替?

this link http://www.peterbe.com/plog/button-tag-in-IE makes me believe that in IE7 the button element will not post a single string to your controller so would not match the signature of your controller method, have you tried (as is suggested here) using input elements of type submit instead?

这不是我见过的东西,但似乎与您的问题相符

its not something I have seen myself but it seems to match your issue

这篇关于按钮标记在IE7中不起作用(使用asp.net mvc)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:36