开发者

button tag not working in IE7 (using 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.

But the problem is the button click is working in IE8,chrome,ff but not in 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 ???

thanks I appreciate any answer..

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

<% using (Html.BeginForm("ListEntries","Home",FormMethod.Post, new { @Id = "MyForm" } )) {%>
                        <button name="button" value="next开发者_JAVA百科">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");

}


Button tags in IE (v. 8, at least) will not work without an 'onclick' handler. Well, at least you can't simply wrap the button in an anchor tag.

Doesn't work:

<a href="link.html">
    <button>Click Me!</button>
</a>

Works:

<a href="link.html" onclick="javascript:window.location=this.href">
    <button>Click Me!</button>
</a>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜