ActionLink和jQuery

时间:2015-03-23 15:49:05

标签: jquery ajax pagination asp.net-mvc-5 actionlink

我正在使用jQuery Pagination plugin

要配置网址,我需要设置href属性。

$(selector).twbsPagination({
    totalPages: 35,
    visiblePages: 8,
    href: '?page={{number}}'
});

如何为Ajax.ActionLink()分配href

$(#someid).twbsPagination({
        totalPages: 35,
        visiblePages: 8,
        href: '@Ajax.ActionLink(
                "{{number}}", 
                "Action", 
                "Controller", 
                new {page = "{{number}}"}, 
                new AjaxOptions() { HttpMethod = "POST"})'});

有可能吗?

1 个答案:

答案 0 :(得分:0)

是的,但不是那样的。这将呈现一个实际的表单元素,您需要url helper

$(#someid).twbsPagination({
    totalPages: 35,
    visiblePages: 8,
    href: "@(Url.Action("actionName","controllerName"))"+'?page={{number}}'