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

Binding to Objects

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 30 Jun 2010, 05:24 PM
I have an object model defined using Open Access. The object has a collection of child objects.

I want to:
  1. display my objects in a grid
  2. display the objects in the child collection in a details grid.
  3. use the fact that OA is prefetching the child data for me to populate the child grids.

Items 1 and 2 are straightforward, I've created the grid and created a child grid. It's 3 that's causing me the problem.

All of the examples I've seen to use 2 separate fetches, usually via SQL to populate the grids; the first for the master table the 2nd for the child grid.

What I hoped to do was get the DetailTableDataBind event to fire for each row in the master table view that was bound, access the parent item and set the data source of the detail table to the collection of child objects.

Sadly this won't work (prolly 'cos I'm doing it wrong).

I've set the detail table up using this ...
<telerik:GridTableView Name="Locations" HierarchyLoadMode="ServerBind"

And from what I read in the docs, I expected this to cause the DetailTableDataBind to fire after the ItemDataBound event for each item in the MasterTableView. It doesn't. In fact it doesn't fire 'til the master table's row is expanded.

The next problem is that when the DetailTableDataBind event fires I can't get at the parent row's data object, this is, I assume, 'cos it's only available when the ItemDataBound event for that row fires.

So, just how much of what I've read in the docs have I failed to understand? 

And is it actually possible to bind a DetailTableView to the child objects of an object without going to the data store a 2nd time?

-- 
Stuart

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 06 Jul 2010, 08:06 AM
Hello Stuart,

With HierarchyLoadMode ServerBind or Client, each detail table is databound right after it is created. This happens after the MasterTableView databinds in the same initial page life cycle. Expand / collapse commands are then used to only toggle the visibility of the detail tables on the server or on the client, respectively.

Attaching a test page that demonstrates this.

Sincerely yours,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Veli
Telerik team
Share this question
or