簡體   English   中英

在ajax調用中設置Model.PageNumber不起作用

[英]Setting Model.PageNumber in ajax call not working

我為什么不能這樣做?

當我的控制器方法被點擊時,pageNumber不會通過發送。

@Ajax.ActionLink(">>", "PersonList", new { nextPage = Model.PageNumber + 1 }, new AjaxOptions { HttpMethod = "get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "updateContent" }, new { @class = "btn btn-info" })

這是我的動作方法簽名:

public ActionResult PersonList(string searchString, string searchOptions, string sort, string sortDirection, int? pageNumber)

任何幫助將不勝感激。

我解決了 我在Action方法中重命名了參數名稱,但是忘記了在ajax調用中重命名路由值名稱。

將我的ajax調用更改為以下內容可以解決此問題。

@Ajax.ActionLink(">>", "PersonList", new { pageNumber = Model.PageNumber + 1 }, new AjaxOptions { HttpMethod = "get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "updateContent" }, new { @class = "btn btn-info" })

暫無
暫無

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

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