我有以下标签链接,它们将更改webgrid中显示的数据,如下所示
按照相同的cshtml文件,
<div class="top-grid">
<div class="container">
<div class="col-md-2">
<p>
<a href="#" id="EligiblePayLink">ELIGIBLE FOR EARLY PAY</a>
</div>
<div class="col-md-2">
<h2>@Model.SupplierInitialPage.PendingInvoicesCount</h2>
<p>
<a href="#" id="PendingApprovalLink">PENDING APPROVAL</a></p>
</div>
</div>
<div class="clearfix">
</div>
</div>
<div class="bottom-grid" id="InvoiceGridContents">
</div>
以下是带有控制器类
的局部视图 WebGrid grid = new WebGrid(Model.EligiblePayInvoices, canPage: true, rowsPerPage: recCount);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(
tableStyle: "table", // applying style on grid
fillEmptyRows: true,
//show empty row when there is only one record on page to it will display all empty rows there.
headerStyle: "header", //applying style.
footerStyle: "grid-footer", //applying style.
mode: WebGridPagerModes.All, //paging to grid
firstText: "<< First",
previousText: "< Prev",
nextText: "Next >",
lastText: "Last >>",
columns: new[] // colums in grid
{
grid.Column(header:"DATE SUBMITTED",columnName: "DateSubmitted",style: "width-250px"), //the model fields to display
grid.Column(header:"INVOICE #",columnName: "InvoiceNumber",style: "width-250px"),
grid.Column(header:"INVOICE TITLE",columnName: "InvoiceTitle",style: "width-250px"),
grid.Column(header:"AMOUNT",columnName:"InvoiceAmount",style: "width-250px"),
grid.Column(header:"PO#",columnName: "PONumber",style: "width-250px"),
grid.Column(header:"STATUS",columnName:"Status",format: item => Html.Raw(item.Status),style: "width-250px")
})
现在是控制器类,
[HttpGet]
public ActionResult ShowInvoiceGrid(int Id = 1)
{
var type = (PayInvoiceStatusType)Id;
PayInvoiceViewModel _invoiceModel = objHelper.GetStreamPaySession(Session);
if (_invoiceModel != null)
_invoiceModel = UpdatePayInvoiceViewModel(type);
else
_invoiceModel = CreateInitialPayInvoiceViewModel(type);
return PartialView("_InvoiceGrid", _invoiceModel);
}
问题是,当我点击webgrid的标题时,它触发自定义控制器操作方法并仅返回网格局部视图而不是整页。有什么想法吗?