Hi, am new to this.
I'm using:
ASP.Net/VB
self-servicing,
LLBLGen 1.0.2005.1 Final,
ORMSupportClasses.NET11.dll version 1.0.20051.60224
Visual Studio 2003 and .Net 1.1
I am struggling to display hierarchical data. I've opted to display it within nested MS datagrids. The database structure is as follows:
Order
....|-----OrderItem (m:1)
.................|--------ItemDetail (m:1)
.................|--------ItemSpecial (m:1)
These relationships are defined in LLBLGen but not the database.
The objective is to search orders against any combination of orderID, Purchaser, OrderDate, etc. which is taken care of.
Top level results display a list of orders. A "detail" button to reveals the related data. It simply sets the current record to "Edit". The EditItemTemplate contains the nested datagrids that display the related data. So the datagrid(s) appear as follows:
Order 1 - summary details |
Order 2 - summary details |
Order 3 - selected |
.....Full details... |
..... |
-------------------------------------------------- |
..... |
Item 1 - Product name, etc |
..... |
..... |
--------------------------------------- |
..... |
..... |
Item detail 1 |
..... |
..... |
Item detail n |
..... |
..... |
--------------------------------------- |
..... |
|
..... |
..... |
--------------------------------------- |
..... |
..... |
Item special1 |
..... |
..... |
Item special n |
..... |
..... |
--------------------------------------- |
..... |
Item n... |
..... |
-------------------------------------------------- |
Order n - summary details |
------------------------------------------------------------- |
The Orders are displayed using a typed list as follows:
With dgrd
.DataSource = orders //orders is the typed list with predicates etc.
.DataBind()
End With
orders.Dispose()
The ItemDataBind function displays the nested datagrids:
//find selected orderID
Dim OID As Int64 = DataBinder.Eval(e.Item.DataItem, "OrderID")
//locate nested grid
Dim dgrdItems As DataGrid = CType(e.Item.FindControl("dgrdItems"), DataGrid)
//orderItems details
Dim oItems As New SignSharkDB.TypedListClasses.OrderItemsListTypedList
Dim oIPE As IPredicateExpression = New PredicateExpression
Dim pred As IPredicateExpression = New PredicateExpression
pred.Add(PredicateFactory.CompareValue(SignSharkDB.OrderItemFieldIndex.Id, ComparisonOperator.Equal, OID))
oIPE.Add(pred)
Dim oSorter As ISortExpression = New SortExpression( _
SortClauseFactory.Create(SignSharkDB.ProductFieldIndex.Name, SortOperator.Ascending))
With oItems
.Fill(0, Nothing, False, Nothing, Nothing, Nothing, 0, 0)
End With
With dgrdItems
.DataSource = oItems
.DataBind()
End With
A similar procedure is then used to populate the ItemSpecial Datagrid.
There has to be a better way. Really appreciate your help and will take comments on the chin.