为什么jQuery UI的对话框休息asp.net的MVC的默认模型绑定。
-
21-09-2019 - |
题
我刚执行的演示jquery的UI对话框(模型对话框)样品 并试图把它列入我的asp.net mvc的项目,我已经观察到一些奇怪的。
如果你有一个jQuery UI的对话框div标签里面的内容,默认的模型绑定不发送到服务器,因为它在如果从形式去除这些元素把它捡起来
全视图的代码如下。如果在底部看到,有部分,其中的对话框的含量:
<div id="dialog"
的问题是,在我的“分区对话”内表,还存在的一定数量的映射到我的结合数据对象字段的输入。当我在调试期间看我的控制器动作,这些都是空发布后。
什么可以在jQuery UI的对话框js代码做将从默认的模型粘合剂“范围”发布时,作为代码的形式元素中删除吗?
的 JavaScript代码:强>
<script type="text/javascript">
$(function() {
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 500,
width: 500,
modal: true,
buttons: {
'Create an account': function() {
的 HTML代码强>
<% using (Html.BeginForm("UpdateTester", "Applications", FormMethod.Post))
{%>
<table id="users" class="ui-widget ui-widget-content">
<thead>
<tr class="ui-widget-header ">
<th>Name</th>
<th>Email </th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type='hidden' name='peopleUpdater.person[0].c' value="1" />
<input type='hidden' name='peopleUpdater.person[0].b.Id' value="1" />
<input type='hidden' name='peopleUpdater.person[0].a[0].Id' value="1" /> John Doe
<input type='hidden' name='peopleUpdater.person[0].name' value="joe" />
</td>
<td>
john.doe@example.com
<input name='peopleUpdater.person[0].email' type='hidden' value="email" />
</td>
<td>
Locations:
<%=Model.BusinessLocations.Length %><input type="button" value="Details" id="showDetails" />
</td>
</tr>
</tbody>
</table>
</div>
<input type="submit" id="Button1" class="ui-button ui-state-default ui-corner-all" />Submit
<div id="dialog" title="Create new user">
<%=ApplicationHTMLHelper.BuildTableLocations("aa", Model.Application.BusinessLocations, true, "peopleUpdater.person[0]")%>
</div>
<% } %>
解决方案
不隶属于 StackOverflow