sortable telerik grid + NHibernate, IQueryable and ASP.NET MVC

≯℡__Kan透↙ 提交于 2019-12-01 13:37:00

I just did this yesterday. There is a code sample of this working that Telerik put together which was super useful: http://www.telerik.com/community/code-library/aspnet-mvc/grid/nhibernate-binding.aspx

A couple of things to point out:

  • You need to use Nhibernate 3.x. Otherwise filtering won't work
  • You don't need to have the paging code, The telerik gridcommand contains that info and plugs it into the IQueryable for you
  • This only works with a client side ajax binding, this should look something like: .DataBinding(dataBinding => dataBinding.Ajax().Select("index", "mycontroller"))
  • As you are using ajax binding you won't need to pass the model to the grid, instead you specify the type of model, like so: .Grid<ItemRowViewModel>()

It worked super well for me in a grid with 400,000 rows. Let me know if you have any trouble setting it up.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!