1

我在主cshtml中有一个网格作为部分视图。当我单击网格中的页码时,网格正在消失。有什么建议吗?

Devices.csthml(部分视图)

即使我在部分视图中有 div my-grid 。

<div id="my-grid">
    @{

        var grid = new WebGrid(
                               canPage: true,
                               canSort: true,
                             rowsPerPage: 3,
                             ajaxUpdateContainerId: "my-grid");

            grid.Bind(Model, rowCount: Model.Count(), autoSortAndPage: true);



        @grid.GetHtml(
        htmlAttributes: new { id = "my-grid" },
        tableStyle: "grid1",
        headerStyle: "header",
        rowStyle: "row",
        footerStyle: "footer",
        alternatingRowStyle: "altRow",
        columns: grid.Columns(
                                grid.Column("ObjectOfServiceName", "Device Name", style: "textCol"),
                                grid.Column("SerialNumber", "Serial Number", style: "textCol"),
                                grid.Column("ContractIdentifier", "Contract Identifier", style: "textCol"),
                                grid.Column("ServiceLevelCode", "Service Level", style: "textCol"),
                                grid.Column("UserDeviceDescription", "Device Grouping", style: "textCol"),
                                grid.Column(header: "", format: @<text>@Html.ActionLink("Upgrade", "DeviceUpgradePartial", new { objectOfServiceId = item.ObjectOfServiceId, serviceContractId = item.ServiceContractId, serialNumber = item.SerialNumber, objectOfServiceName = item.ObjectOfServiceName, serviceLevelId = item.ServiceLevelId, deviceGroupingId = item.DeviceGroupingId }, new { @class = "upgradeLink", title = "Upgrade Device" })" </text>, style: "colOperation"),
                                grid.Column(header: "", format: @<text>@Html.ActionLink("Update", "DeviceUpdatePartial", new { objectOfServiceId = item.ObjectOfServiceId, serviceContractId = item.ServiceContractId, serialNumber = item.SerialNumber, objectOfServiceName = item.ObjectOfServiceName, serviceLevelId = item.ServiceLevelId, deviceGroupingId = item.DeviceGroupingId }, new { @class = "updateLink", title = "Update Device" })" </text>, style: "colOperation"),
                                grid.Column(header: "", format: @<text>@Html.ActionLink("ReassignDeviceGroup", "ReassingDeviceGroupingPartial", new { objectOfServiceId = item.ObjectOfServiceId, serviceContractId = item.ServiceContractId, serialNumber = item.SerialNumber, objectOfServiceName = item.ObjectOfServiceName, serviceLevelId = item.ServiceLevelId, deviceGroupingId = item.DeviceGroupingId }, new { @class = "reassingDeviceGroupLink", title = "Update Device" })" </text>, style: "colOperation")

                            ), mode: WebGridPagerModes.All)




    }
</div>

主.cshtml:

 <tr>
                @using (Html.BeginForm())
                {

                    <td>Select customer Name</td>
                    <td>

                        @Html.DropDownListFor(m => m.customer_id, new SelectList(Model.customerList, "customer_id", "customer_business_name"))
                        <input type="hidden" id="hdnCustomerName" name="hdnCustomerName" />
                        <input type="hidden" id="hdnShowHideCustInfo" name="hdnShowHideCustInfo" />
                        <input type="submit" value="Go" name="Go" id="Go" />
                       </td>                   

                }
            </tr>

        </table>

    </div>




        @if (Model.objectOfServiceListDevice != null)
        {
            @Html.Partial("Devices", Model.objectOfServiceListDevice)
        }
4

1 回答 1

0

我会尝试替换这个:

@if (Model.objectOfServiceListDevice != null)
{
    @Html.Partial("Devices", Model.objectOfServiceListDevice)
}

有了这个:

<div id="myGrid">
    @Html.Partial("Devices", Model.objectOfServiceListDevice)
</div>
于 2013-04-30T16:41:18.957 回答