Retrieve data from DBset to IQueryable

Nov 2, 2013 at 5:32 PM
Hi all,

I'm new to, so please excuse my ignorance. I'd like to implement Grid.mvc but I'm stuck while passing IQueryable from entities DBset. I want IQueryable instead of IEnumerable because the table is big, I can't retrieve all rows each time.

This work when I dont use the Grid.mvc :
public class AddressController : Controller
        private eveEntities db = new eveEntities();

        public ActionResult Index()
           return View(db.ADDRESS.Take(100).ToList() );
All test I've done so far failed with an exception
What should I put into Index() method to convert DBset to IQueryable ?
Also, what should be put into Index.cshtml ?
I've this right now :
@model IEnumerable<eveTestMvc.Models.AddressModel>
@using GridMvc.Html

Nov 6, 2013 at 2:55 AM

ToList() method already queries all your data from datasource, you shouldn't use that. But you need to sort your collection before pass them to the grid (avoid paging exceptions)
return View(db.ADDRESS.OrderBy(a=>a.Name) );