This is a migrated thread and some comments may be shown as answers.

[Solved] Ajax binding with telerik - what is this meant to return?

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 09 Sep 2010, 05:53 AM

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. Edit: Actually believe this method runs for any click on the grid control.

        [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 Answer, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 09 Sep 2010, 08:58 AM
Hi,

I believe that the _FirstLook Action return GridModel serialized as JSON. It is a bit confusing, because the Action returns View(GridModel), the real deal is in the [GridAction] attibute. Its task is to get GridModel passed to the View() method and return its JSON representation.
GridModel accepts IEnumerable collection. So it doesn't matter what data provider you are using if still returned data is IEnumerable collection.

Regards,
Peter
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Share this question
or