Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class) Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Go Back  Xtreme Visual Basic Talk > > > Datagrid with child rows using listof(class)


Reply
 
Thread Tools Display Modes
  #1  
Old 12-25-2014, 03:30 AM
gilbar gilbar is offline
Newcomer
 
Join Date: Dec 2014
Posts: 1
Unhappy Datagrid with child rows using listof(class)


Hi,
I have the following classes in my code:

Public Class Treatment
Public TreatedCar As Car
Public Ttype As TreatmentType
Public Actions As List(Of TreatmentActions)
Private _TreatmentID As Integer
Private _TreatmentDate As String
Private _Tsum As String
Private _Comments As String

Property TreatmentID()
Get
TreatmentID = _TreatmentID
End Get
Set(ByVal value)
_TreatmentID = value
End Set
End Property

Property TreatmentDate()
Get
TreatmentDate = _TreatmentDate
End Get
Set(ByVal value)
_TreatmentDate = value
End Set
End Property

Property Tsum()
Get
Tsum = _Tsum
End Get
Set(ByVal value)
_Tsum = value
End Set
End Property

Property Comments()
Get
Comments = _Comments
End Get
Set(ByVal value)
_Comments = value
End Set
End Property

Sub New()

If TreatedCar Is Nothing Then
TreatedCar = New Car
End If

If Ttype Is Nothing Then
Ttype = New TreatmentType
End If

If Actions Is Nothing Then
Actions = New List(Of TreatmentActions)
End If

End Sub

End Class

**********

Public Class Car
Private _CarID As Integer
Private _CarNumber As String
Private _CarType As String
Private _RegistrationDate As String
Private _InsurenceDate As String
Private _Comments As String
Private _ActiveCar As ActiveRecord

Property CarID()
Get
CarID = _CarID
End Get
Set(ByVal value)
_CarID = value
End Set
End Property

Property CarNumber()
Get
CarNumber = _CarNumber
End Get
Set(ByVal value)
_CarNumber = value
End Set
End Property

Property CarType()
Get
CarType = _CarType
End Get
Set(ByVal value)
_CarType = value
End Set
End Property

Property RegistrationDate()
Get
RegistrationDate = _RegistrationDate
End Get
Set(ByVal value)
_RegistrationDate = value
End Set
End Property

Property InsurenceDate()
Get
InsurenceDate = _InsurenceDate
End Get
Set(ByVal value)
_InsurenceDate = value
End Set
End Property

Property Comments()
Get
Comments = _Comments
End Get
Set(ByVal value)
_Comments = value
End Set
End Property

Property ActiveCar()
Get
ActiveCar = _ActiveCar
End Get
Set(ByVal value)
_ActiveCar = value
End Set
End Property

End Class

**********

Public Class TreatmentType
Private _TreatmentID As Integer
Private _TreatmentDesc As String
Private _TopLevelID As Integer

Property TreatmentID()
Get
TreatmentID = _TreatmentID
End Get
Set(ByVal value)
_TreatmentID = value
End Set
End Property

Property TreatmentDesc()
Get
TreatmentDesc = _TreatmentDesc
End Get
Set(ByVal value)
_TreatmentDesc = value
End Set
End Property

Property TopLevelID()
Get
TopLevelID = _TopLevelID
End Get
Set(ByVal value)
_TopLevelID = value
End Set
End Property

End Class

**********

Public Class TreatmentActions

Private _ActID As Integer
Private _Action As String

Property ActID()
Get
ActID = _ActID
End Get
Set(ByVal value)
_ActID = value
End Set
End Property

Property Action()
Get
Action = _Action
End Get
Set(ByVal value)
_Action = value
End Set
End Property

End Class

I have a function that populates a list of(Treatment class)

the data look like this (Example)
ID DATE Car Number TreatmentType Comments Price Actions
13 2012-01-01 64-362-55 BIG None 100.00 replace wheel
13 2012-01-01 64-362-55 BIG None 100.00 clean car
14 2014-01-01 64-363-55 Medium nice! 150 battery

As you can see the first two rows has the same ID, Date, CarNumber, treatmentType, Comments and price but the action field is different.

The user has the ability to chose which of the fields to see in the report so the datagrid columns should be programmed in the code behind and not in the asp page.

I have two problems:
1) How do I access the inner data fields listof(class (Treatment)) which has a list of (Another class(TreatmentActions) which has a parameter (Action).
2) How do I set the datagrid to show in first row the common fields (ID, Date, CarNumber, treatmentType, Comments and price) and in the sub rows to show the unique fields (Actions).

Thanks!

Gil
Reply With Quote
Reply

Tags
class, gridview, listof


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class) Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class) Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
 
Datagrid with child rows using listof(class)
Datagrid with child rows using listof(class)
 
-->