簡體   English   中英

_布局樣式不適用於彈出窗口中呈現的部分視圖

[英]_Layout styles not applied to Partial View rendered in a popup

我正在使用以下代碼在彈出窗口中加載部分視圖:

<div id="Mydiv" title="Modify" class="ModifyRule" style="overflow: hidden" />
    <script type="text/javascript">
        $(document).ready(function () {
            //define config object
            var dialogOpts = {
                title: "Modify Rule",
                modal: true,
                autoOpen: false,
                height: 300,
                width: 700,
                open: function () {
                    //display correct dialog content
                    $("#Mydiv").load("Modify", { SelectedRow: $('#MyParam').val() });
                }
            };
            $("#Mydiv").dialog(dialogOpts);    //end dialog

            $('#Modify').click(
            function () {
                $("#Mydiv").dialog("open");
                return false;
            }
        );

        });


    </script>

這是部分視圖中的代碼:

@Code

    Using (Html.BeginForm())
    @<div id="Master">
        <table>
                          <tr>
                <td>
                    @Html.LabelFor(Function(model) model.InputAuthorityGridDetail.TcmAccount)
                </td>
                <td>@Html.EditorFor(Function(model) model.InputAuthorityGridDetail.TcmAccount)
                </td>
                <td>
                    @Html.LabelFor(Function(model) model.InputAuthorityGridDetail.Amount)
                </td>
                <td>@Html.EditorFor(Function(model) model.InputAuthorityGridDetail.Amount)
                </td>
            </tr>
                          <tr align="right">
                <td>
                    <input name="button" type="submit" value="Save" class="btn" />
                </td>
            </tr>
        </table>
             </div>    
    End Using

End Code

控制器方法Modify返回一個名為_Modify的局部視圖,該視圖在彈出窗口中已正確呈現,但是我注意到CSS樣式未應用於該局部視圖中的控件,有人可以幫助我嗎?

將部分加載到布局頁面時,該布局頁面包含對該部分視圖使用的css的引用。

但是,從我在這里收集的信息(我的JavaScript並不是很好),您是將部分代碼直接加載到彈出顯示中,而不使用布局頁面嗎? 如果這是正確的,那么您的部分將不會了解CSS。 要更正此問題,您需要在局部文件頂部添加對css的引用。

我的局部視圖不以@Code開頭,也不以結束代碼結尾。 嘗試將其刪除,然后查看是否可行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM