2013-04-27 2 views
1

У меня есть сетка в виде частичного просмотра в моем главном cshtml. Когда я нажимаю номер страницы в области, сетка исчезает. любое предложение?Webgrid исчезает при нажатии на разбиение на страницы в MVC3

Devices.csthml (PartialView)

Даже я Див мою-сетку в частичном виде.

<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> 

Main.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) 
     } 

ответ

0

Я хотел бы попробовать заменить это:

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

С этим:

<div id="myGrid"> 
    @Html.Partial("Devices", Model.objectOfServiceListDevice) 
</div>