views:

34

answers:

1

Looking at: http://demos.telerik.com/aspnet-mvc/Grid?theme=vista

Can anyone tell me what _FirstLook() is meant to return?

It is implementing the paging I think.

        [GridAction]
        public ActionResult _FirstLook()
        {
            return View(new GridModel(GetOrderDto()));
        }

Every example I find calls a method GetOrders() or GetOrderDto() etc

Here is an example of that:

private IEnumerable<Order> GetOrders()
        {
            DataLoadOptions loadOptions = new DataLoadOptions();

            loadOptions.LoadWith<Order>(o => o.Customer);
            northwind.LoadOptions = loadOptions;

            return northwind.Orders;
        }

Am I just meant to provide a subset of the list based upon the page number clicked? How is the value transferred?

It appears all of this is using a design pattern that I am not which is why its not making sense.

I am using ADO.NET Entity Data Model not LINQ-SQL like I think this is using, so I don't have .LoadOptions available. But surely I'm able to get this working using ADO.NET Entity Data Model rather than LINQ-SQL - it shouldn't matter?

+1  A: 

In short the GridAction attribute converts the GridModel object to JSON which then the grid is using to bind. The GridModel accepts an IQueryable returned from your data provider (our demos use Linq to SQL but you can easily use Entity Framework). The GridAction attribute will do the paging, sorting etc for you - you just need to pass an IQueryable in the GridModel constructor.

More details can be found in the Grid Ajax Binding help topic.

korchev