使用HTML Helper PageListPager刷新桌子,无需刷新页面
我有以下代码行,该行使用HTML助手的pagdlistPager
:
@html.pageDlistPager(model.kyc_paged_list,page => url.action(“ clientdetails”(“ clientdetails”),new {id = viewBag。 id,kyc_page = page,transaction_page = model.transaction_page,active =“ kyc”}))
在单击Pager整个页面重新加载时。但是我只希望带有id =“ kyc-History”
的表才能刷新。
我知道如何使用JavaScript函数重新加载表,但是我不知道如何从pageDlistPager
调用它。 有什么想法,我怎么能称呼它?假设JS函数称为reloAdtable()
I have the following line of code which uses html helper's PagedListPager
:
@Html.PagedListPager(Model.kyc_paged_list, page => Url.Action("ClientDetails", new { id = ViewBag.ID, kyc_page = page, transaction_page = Model.transaction_page, active = "kyc" }))
When clicking on the the pager the entire page reloads. But I only want the table with id="kyc-history"
to refresh.
I know how to reload the table using a JavaScript function but I don't know how to call it from the PagedListPager
.
Any ideas how I can call it? Let's say that the JS function is called reloadTable()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了同样的问题,这篇文章(由安德斯·莱贝克(Anders Lybecker)完成)帮助了我,现在一切正常!
步骤非常清楚,但是请确保在开始之前备份!
看看:
ajax ajax ajax ajax for ASP的分页。 net MVC站点
总而言之,您在控制器中以2个视图1的页面为“控制器”(在我的情况下是索引视图),其中包含
page> pagdlistPager
Control(Control)的另一个列表(列表视图)。并将列表视图放入索引视图中。并在索引视图中为PagedListPager编写jQuery代码。您可以阅读文章以获取详细信息!
这是我的代码,还有一些额外的内容,我注意到可以为您提供更多帮助:
列表视图:
注意:确保制作
layout = null;
,然后放置样式链接&在此观点中,脚本手册避免了设计问题。在控制器中:(在我的情况下为Home Controller)
索引视图:
注意:确保将HTML(结果)放在我的情况下列表的根容器中; 。
希望这对您有帮助:)
I was having the same problem and this article (done by Anders Lybecker) helped me out and now everything working!
It's very clear with steps, But make sure to make backup before starting!
Take a look:
AJAX paging for ASP.NET MVC sites
In summary you make 2 Action Results in your Controler with 2 Views 1 for your page (in my case it's Index View) the other for the List that contain the
PagedListPager
control (List View). And put the list View inside the Index View. And write the JQuery code for the PagedListPager in the Index View.You can read the article for the details!
And this is my code with a little extra things I noticed to help you more:
The List View:
Note: Make sure to make
Layout = null;
and put the Styles Links & the Scripts manual in this View to avoid design issues.In the Controller: (it's Home Controller in my case)
The Index View:
Note: Make sure to put the html(result) in the root container of the list in my case was
<section id="maincontent">
.Hope this help you out :)