Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么jquery ui对话框会破坏asp.net mvc';默认的模型绑定。_Jquery_Asp.net Mvc_Binding_Jquery Ui Dialog - Fatal编程技术网

为什么jquery ui对话框会破坏asp.net mvc';默认的模型绑定。

为什么jquery ui对话框会破坏asp.net mvc';默认的模型绑定。,jquery,asp.net-mvc,binding,jquery-ui-dialog,Jquery,Asp.net Mvc,Binding,Jquery Ui Dialog,我刚拿了那张票 并试图将其纳入我的asp.NETMVC项目中,我发现了一些奇怪的现象 如果jquery ui对话框div标记中包含内容,则默认模型绑定器在发布到服务器时不会拾取内容,因为如果从表单中删除了这些元素 完整视图代码如下所示。如果在底部看到,则有一个部分显示对话框的内容: <div id="dialog" 我发现另一个Stackoverflow问题也有类似的问题,并且部分有效 它会在提交之前将对话框元素推回到表单中并修复问题 <script type="text/jav

我刚拿了那张票 并试图将其纳入我的asp.NETMVC项目中,我发现了一些奇怪的现象

如果jquery ui对话框div标记中包含内容,则默认模型绑定器在发布到服务器时不会拾取内容,因为如果从表单中删除了这些元素

完整视图代码如下所示。如果在底部看到,则有一个部分显示对话框的内容:

<div id="dialog"

我发现另一个Stackoverflow问题也有类似的问题,并且部分有效

它会在提交之前将对话框元素推回到表单中并修复问题

<script type="text/javascript">
    $(function() {

        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 500,
            width: 500,
            modal: true,

            buttons: {
                'Create an account': function() {
    <% 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>

<% } %>