在mvc razor 4中将topagedlist值放入数据表中 [英] topagedlist value into datatable in mvc razor 4

查看:58
本文介绍了在mvc razor 4中将topagedlist值放入数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有数据表,我显示为部分视图



i使用的模型,



列表< products> promodel = GetProductsModel(dtTemp);



pageSize = 25;



// page =这将来当第1页2 3 4 5被点击时..



pageNumber = page;



返回PartialView( promodel.ToPagedList(pageNumber,pageSize));



这个工作正常..但我也有过滤值。按评级排序,按价格排序..



所以我想要的是,如果用户点击2页,然后按评级排序过滤,它应该过滤值仅在第2页..



所以如何获得



有没有办法获得预告。 ToPagedList(pageNumber,pageSize值到数据表中,所以我可以使用预先使用的页码对数据表进行排序



i希望你理解

解决方案

您应该使用LINQ来执行排序过滤任务,以及分页逻辑。



在我的下一篇文章中您有示例(包括完整的源代码) )做所有这些: MVC基本站点:第4步 - MVC中的jqGrid集成4.0使用AJAX,JSON,jQuery,LINQ和序列化 [ ^ ]

hi,

i have datatable, which i display as partialview

i have used model ,

List<products> promodel = GetProductsModel(dtTemp);

pageSize=25;

//page= this will come when page 1 2 3 4 5 is clicked..

pageNumber = page;

return PartialView(promodel.ToPagedList(pageNumber, pageSize));

this works ok.. but i also have filtering values . sort by rating,sort by price..

so what i want is , if a user clicks on 2 page , and then sort filtering by rating, it should filter values in only 2nd page..

so how to get

is there any way to get promodel.ToPagedList(pageNumber, pageSize value into datatable so i can diectly sort datatable with preused page number

i hope you understood

解决方案

You should use LINQ to do your sort filtering tasks, and also the pagination logic.

In my next article you have example (including the full source code) of doing all of these: MVC Basic Site: Step 4 – jqGrid Integration in MVC 4.0 using AJAX, JSON, jQuery, LINQ, and Serialization[^]


这篇关于在mvc razor 4中将topagedlist值放入数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆