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

[Solved] Is CustomBinding required for this situation?

2 Answers 101 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.
flipdoubt
Top achievements
Rank 1
flipdoubt asked on 29 Apr 2010, 09:38 PM
Originally I thought I wanted to use AjaxBinding to fetch my data items only after the grid needs the first page, but all the examples I have seen make it look like the GridModel wants all the available data items so it can perform the sorting itself. Is this true? What if I only want to fetch the required items from the database and, rather than return entities that map to an entire row, what if I want to return the product of a join? Does this sound like I have to go for the custom binding?

2 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 30 Apr 2010, 06:03 AM
Hi FlipDoubt,
      If I had to do something like that, I would consider a ViewModel to define only the fields (which include the fields from the join) that would show in my grid. 
     When the AjaxBinding goes to the controller to get its data, that is the server, so I dont think you need custom binding there. 
     There are ways to create custom sorting - if your join didnt do that already.
      
      
0
flipdoubt
Top achievements
Rank 1
answered on 30 Apr 2010, 04:49 PM
I am not as concerned about the width of the data (as in joins across many tables) as I am about the depth of the data. Yes, I am concerned about the result set being larger than it needs to be, but I am more concerned about the architecture in that I don't want my DataContext/Connection to be open in the controller. I have a data-layer that lives in a separate assembly and does all the database manipulation there. I am wondering about the custom binding because I might need to do the sorting at in my data-access layer and bring back only the data for the current page because I need to close the database connection before returning the data back to the controller. See my other post here.

Update: I ended up going with CustomBinding. Works fine.
Tags
Grid
Asked by
flipdoubt
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
flipdoubt
Top achievements
Rank 1
Share this question
or