当我使用 Jquery 渲染部分视图时,引导程序不起作用

When i render a partial view with Jquery the bootstrap does not work

提问人:Alexandre Costa Rodrigues 提问时间:1/27/2023 更新时间:1/27/2023 访问量:64

问:

这是我在组合框中选择选项时用于呈现部分视图的代码

<div class="row">
        <div class="col-md-6">
                        <div class="form-group">
                            @Html.DropDownList("Relatorios", ViewBag.Tipos as SelectList, new { id = "Relatorios" })
                        </div>
                    </div>
                </div>
<div class="form-group" id="showdata"></div>

<script>
        $(window).load(function () {
            $("#Relatorios").on("change", function () {
                settabledata();
            });


            function settabledata() {
                var url = '@Url.Action("RenderizarRelatorios", "Cartoes")';
                $.ajax({
                    url: url,
                    data: { "SelectId": $("#Relatorios").val() },
                    success: function (data) {
                        $("#showdata").html(data);
                    }
                });
            }
        });


    </script>

这是我将从控制器接收的数据呈现为 HTML 的部分视图

<div class="panel panel-primary">
    <div class="panel-body">
        <h2>Clientes em cobrança</h2>
        <table class="datatable">
            <thead>
                <tr>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.DataLiquidacao)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.SinacorCode)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.AccountCodeBP)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.Name)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.AdvisorsName)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.AdvisorsGroup)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.OverdueDays)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.NegativeDay)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.DueDate)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.CurrentPatrimony)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.NovoPerfil)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.DebtAmount)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.UpdatedDebtAmount)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.ProcessorAccountId)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.Produto)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.GlobalLimit)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.UsedLimit)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.UpdatedBalance)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.ValorAjuste)</th>
                    <th>@Html.DisplayNameFor(modelItem => modelItem.Header.IdTipoAjuste)</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Content)
                {
                    <tr>

                        <td>
                            @Html.DisplayFor(modelItem => item.DataLiquidacao)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.SinacorCode)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.AccountCodeBP)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.AdvisorsName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.AdvisorsGroup)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.OverdueDays)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.NegativeDay)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.DueDate)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.CurrentPatrimony)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.NovoPerfil)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.DebtAmount)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.UpdatedBalance)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.ProcessorAccountId)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Produto)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.GlobalLimit)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.UsedLimit)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.UpdatedBalance)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.ValorAjuste)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.IdTipoAjuste)
                        </td>

                    </tr>
                }

            </tbody>
        </table>

    </div>
</div>

但是当部分视图呈现时,看起来 id 没有我赋予它的引导属性。部分视图的呈现方式

jQuery asp.net ASP.NET-MVC-3 剃刀

评论

0赞 Serge 1/27/2023
动作代码在哪里?

答: 暂无答案