首页 > Web开发 > 详细

ASP.NET MVC的Ajax.ActionLink 的HttpMethod="Get" 一个重复请求的BUG

时间:2014-07-18 16:01:22      阅读:872      评论:0      收藏:0      [点我收藏+]

这段时间使用BootStrap+Asp.net Mvc5开发项目,Ajax.ActionLink遇到一个重复提交的BUG,代码如下:

 1 @model IList<WFModel.WF_Temp>
 2 @{
 3     Layout = null;
 4 }
 5 
 6 <!DOCTYPE html>
 7 
 8 <html>
 9     <head>
10         <meta name="viewport" content="width=device-width" />
11         <title>工作流模板列表</title>
12         <link href="~/Content/bootstrap.css" rel="stylesheet" />
13         <script src="~/Scripts/jquery-2.1.1.js"></script>
14         <script src="~/Scripts/bootstrap.js"></script>
15         <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
16     </head>
17     <body>
18         @Ajax.ActionLink("添加工作流模板", "AddTemp", "WFTemp", new AjaxOptions()
19         {
20             HttpMethod="Get"
21         },new
22         {
23             @class = "btn btn-primary",
24             data_toggle="modal",
25             data_target="#myModal"
26         })
27         <br/>
28         <div class="table-responsive">
29             <table class="table">
30                 <tr>
31                     <th>模板名称</th>
32                     <th>提交时间</th>
33                     <th>模板的描述</th>
34                     <th>模板提交人</th>
35                 </tr>
36                 <tbody>
37                     @{
38                         foreach (var item in Model)
39                         {
40                             <tr>
41                                 <td>@item.TempName</td>
42                             </tr>
43                         }
44                     }
45                 </tbody>
46             </table>
47         </div>
48     </body>
49 </html>
50 <!-- Button trigger modal -->
51 @*<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
52     Launch demo modal
53 </button>*@
54 
55 <!-- Modal -->
56 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
57     <div class="modal-dialog">
58         <div class="modal-content">
59             <div class="modal-header">
60                 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
61                 <h4 class="modal-title" id="myModalLabel">添加模板</h4>
62             </div>
63             <div class="modal-body">
64                 ...
65             </div>
66             <div class="modal-footer">
67                 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
68                 <button type="button" class="btn btn-primary">保存</button>
69             </div>
70         </div>
71     </div>
72 </div>

如何解决呢,HttpMethod="Get"变成"Post"就可以了

ASP.NET MVC的Ajax.ActionLink 的HttpMethod="Get" 一个重复请求的BUG,布布扣,bubuko.com

ASP.NET MVC的Ajax.ActionLink 的HttpMethod="Get" 一个重复请求的BUG

原文:http://www.cnblogs.com/ddddai/p/3852220.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!