JQuery UI 대화 상자가 ASP.NET MVC의 기본 모델 바인딩을 중단하는 이유는 무엇입니까?

StackOverflow https://stackoverflow.com/questions/2077196

문제

나는 방금 가져 갔다 데모 jQuery UI 대화 상자 (모델 대화 상자) 샘플 ASP.NET MVC 프로젝트에 포함 시키려고했는데 이상한 것을 관찰했습니다.

jQuery UI 대화 상자 DIV 태그 내부에 컨텐츠가있는 경우, 기본 모델 바인더는 양식에서 이러한 요소를 제거하면 서버에 게시하는 동안 픽업되지 않습니다.

전체보기 코드는 다음과 같습니다. 하단에 표시되면 대화 상자의 내용이있는 섹션이 있습니다.

<div id="dialog"

문제는 "div 대화 상자"내부의 내 테이블에 바인딩 데이터 객체 필드에 매핑되는 입력이 여러 가지 있다는 것입니다. 디버깅 중 컨트롤러 작업을 볼 때 게시 후 모두 널입니다.

코드가 양식 요소 내부에있을 때 게시 할 때 기본 모델 바인더 "스코프"에서 제거 할 jQuery UI 대화 상자 JS 코드가 무엇을 수행 할 수 있습니까?


자바 스크립트 코드 :

<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 질문을 발견했으며 부분적으로 작동합니다.

jQuery Modal Window는 내 양식에서 요소를 제거합니다

제출하기 전에 대화 상자 요소를 양식으로 다시 밀고 문제를 해결합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top