gpt4 book ai didi

c# - 在 MVC4 分部 View 中使用 PagedList 时的不良行为

转载 作者:行者123 更新时间:2023-11-28 13:03:56 26 4
gpt4 key购买 nike

我有一个局部 View ,显示列表中的多个搜索结果。出于美观原因,我每行显示两个列表项的结果:

list item 1 | list item 2

list item 3 | list item 4

etc....

我正在使用 PagedList 实现分页,因为它是一个局部 View ,所以我正在使用 Ajax.ActionLink 来导航每个“分页列表”。例如:

@Ajax.ActionLink("<<", "GetAllProperties", new { page = 1 }, new AjaxOptions { UpdateTargetId = "quick-property-search-results" })

当页面加载时,列表中的所有元素都正确显示 - 每行两个列表元素。但是,当我单击 Next > 时,会显示下一个元素,但格式会消失,如下所示:

list item 1

list item 2

list item 3

etc...

我尝试将实际上为我提供每行两个列表项布局的 css 类作为 html 属性传递给 ActionLinks,但它没有帮助。

有谁知道是什么导致了这种行为 - 以及如何补救它?

编辑:添加了 css 类和 Razor 代码。

.result-container { 
border: 3px solid #999;
padding: 5px;
margin-bottom: 5px;
margin-right: 5px;
width: 563px;
float: left;
height:130px;
}


@foreach (var result in Model)
{
<div class="result-container">
// output model data...
</div>
}

最佳答案

为@Ajax.ActionLink 生成的标记是什么样的?我猜这是在您的 ajax 调用之后绑定(bind)到您的动态内容的问题。在 jquery 中,您将使用 .on 事件与 .click 事件。

关于c# - 在 MVC4 分部 View 中使用 PagedList 时的不良行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15976119/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com