ASP.NET MVC的Ajax.ActionLink 的HttpMethod="Get" 一個重複請求的BUG

來源:互聯網
上載者:User

標籤:style   blog   http   color   使用   os   

這段時間使用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         },new22         {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 modal53 </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"就可以了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.