Can someone show me an example of a Parent/Child Gridview using CSLACan someone show me an example of a Parent/Child Gridview using CSLA
Old forum URL: forums.lhotka.net/forums/t/2832.aspx
AKaplan posted on Monday, May 07, 2007
I'm having trouble understanding the UI development of a Parent/Child Gridview. I have the objects all worked out. for example if i want to do a Category/Product gridview that the gridview is nested. How can this be accomplished? if i have BO's of Category / ProductChildList as my objects.Jimbo replied on Tuesday, May 08, 2007
Assuming this heirachy:
RootList
RootListItem
ChildList
ChildItem
The following works for me:
In your load /configuration method:
------------------------------------
RootListBindingSource.DataSource = RootList
RootGrid.DataSource = RootListBindingSource
ChildListBindingSource.DataSource = RootListBindingSource
ChildListBindingSource.DataMember = "ChildList" '(where ChildList is a read property of each RootList.Item)
ChildGrid.DataSource = ChildListBindingSource
In your Save method:
----------------------
' rebind the UI
RootListBindingSource.DataSource = Nothing
ChildListBindingSource.DataSource = Me.RootListBindingSource
RootListBindingSource.DataSource = RootList)
ApplyAuthorizationRules()
This is very similar to the example in Project / ProjectResources in ProjectTracker, except that the parent is a root list.
If you like to play around with datasources in the vs designer you should get the same result by navigating to the appropriate node/s.
Jimbo
AKaplan replied on Tuesday, May 15, 2007
Thank You so muchAKaplan replied on Tuesday, May 15, 2007
I have a question. The "RootListBindSource.Datasource" that you mentioned, is this referencing the cslaDatasource, because the cslaDataSource does not have a datasource method in it. Jimbo replied on Wednesday, May 16, 2007
I was describing the use of a Windows forms BindingSource .. sorry but I assumed wrongly that you were taking about a Windows Forms application.
Jimbo.
AKaplan replied on Thursday, May 17, 2007
oh yea i guess that would make a difference huh. Plowking replied on Tuesday, May 08, 2007
Cant quite understand what you are after there... from the naming of your classes I'll assume
-Category inherits BusinessBase
-ProductChildList inherits BusinessListBase
-You dont want to show a list of Categories, each row of which contains a nested datagrid with a list of ProductChild objects
(i.e. assuming that you want to show a child collection in a datagrid on the same page as its parent)
Then you should use the project tracker solution's ProjectEdit.aspx as an example.
JonM replied on Thursday, May 10, 2007
From what I remember that new DataGridView control is .NET 2.0/VS2005 does not support the nested tables like the older DataGrid control does. However, this won't affect your object model, just the UI.AKaplan replied on Tuesday, May 15, 2007
JonM,
the nested gridview is supported. I was able to do it. and there are codeproject.com forums as well.
Copyright (c) Marimer LLC