开发者

Ajax.ActionLink generated markup lacks onclick attribute

开发者 https://www.devze.com 2023-02-17 17:19 出处:网络
I\'ve got problem with generating ajax anchors. I\'m using simple Ajax.ActionLink(\"test\", \"Test\", new AjaxOptions { UpdateTargetId=\"test\", HttpMethod=\"GET\" }) and开发者_如何学编程 the generat

I've got problem with generating ajax anchors. I'm using simple Ajax.ActionLink("test", "Test", new AjaxOptions { UpdateTargetId="test", HttpMethod="GET" }) and开发者_如何学编程 the generated markup is: <a data-ajax="true" data-ajax-method="GET" data-ajax-mode="replace" data-ajax-update="#test" href="/Home/Test">test</a> which, obviously lacks the onclick="Sys.Mvc.AsyncHyperlink.handleClick(...)" attribute.

Anyone faced similar problem?


That's because you use unobtrusive javascript, which does not require the onclick handler.

Unobtrusive javascript is enabled by default in asp.net mvc 3.

The link should work though.

0

精彩评论

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