StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Master-Detail grid bound to a BOExpand / Collapse
Author
Message
Posted 09/21/2006 2:43:11 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:58:27 PM
Posts: 310, Visits: 450
I would like to use a master-detail grid view for my DevExpress grid, but still use a BO or a BusinessBindingSource for the DataSource.  How do I setup the Master/Detail relationship in the BO so that it works in the grid correctly?  It has to know somehow which fields to use in the master view and which in the detail.
Post #2965
Posted 09/21/2006 3:06:10 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
I think you can use the Master-Detail grid with multiple data sources, like a parent & child.  There have been some more changes to the BusinessBindingSource so that it will support the ICurrencyManagerProvider interface better that might help you with configuring your grid.


www.bungie.net
Post #2968
Posted 09/21/2006 3:26:04 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:58:27 PM
Posts: 310, Visits: 450
The way that they show it working is that you set some kind of ChildRelations property on the DataTable that you are setting as the DataSource for the grid.  This determines which columns are treated as master and which as detail on the DevExpress side.  I'm having some trouble finding any kind of ChildRelations collection on the BO. 
Post #2971
Posted 09/21/2006 4:00:35 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:58:27 PM
Posts: 310, Visits: 450
I've tried this but I get an error saying Cannot create a DataRelation if Parent or Child Columns are not in a DataSet.

BusinessObject.CurrentDataTable.ChildRelations.Add("ListRelation", CalcClientBO.CurrentDataTable.Columns("ClientKey"), ClientInfoBO.CurrentDataTable.Columns("ClientKey"))

grdList.DataSource = BusinessObject.CurrentDataTable

Any ideas on anything else I can try?

Post #2972
Posted 09/22/2006 9:12:56 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
No, I'm not sure what else you can try... you might have to create your own DataSet object and add the CurrentDataTables from the business objects you want to include in the grid.  Then, you should be able to display them in the grid, although, you will probably need to set the DataSet as the data source, not one of the business objects.


www.bungie.net
Post #2981
Posted 09/22/2006 9:18:02 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:58:27 PM
Posts: 310, Visits: 450
Yep, here's what I ended up having to do to get it working:

Dim ds As New DataSet
Me.CalcClientBO.FillAll()
Me.ClientInfoBO.FillAll()

ds.Tables.Add(CalcClientBO.CurrentDataTable)
ds.Tables.Add(ClientInfoBO.CurrentDataTable)
ds.Relations.Add(
"ListRelation", ds.Tables(0).Columns("ClientKey"), ds.Tables(1).Columns("ClientKey"), False)

grdList.DataSource = ds.Tables(0)
grdList.LevelTree.Nodes.Add(
"ListRelation", gvListDtl)
grdList.RefreshDataSource()

It would be a lot easier if somehow the ParentRelationship set on the Parent/Child BO's could somehow create this relationship for you, so that you could still just set the BusinessBindingSource or the CurrentDataTable of the BO to the DataSource.

 

Post #2982
Posted 09/26/2006 2:45:05 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
The problem with the BOs being able to do this automatically, is that the DataTables have to belong to a DataSet in order to define the relationships on them.


www.bungie.net
Post #3077
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:10pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.