innominds
asked on
Binding business object (arraylist) with datagrid
I have one business class
Public Class Firm
Dim _FirmID As Integer
Dim _FirmName As String
Public Property FirmID() As Integer
Get
Return _FirmID
End Get
Set(ByVal value As Integer)
_FirmID = value
End Set
End Property
Public Property FirmName() As String
Get
Return _FirmName
End Get
Set(ByVal value As String)
_FirmName = value
End Set
End Property
End Class
i am binding arraylist of objFirms - i am able to bind it. BUT question is sequence of fields are not correctly displayed in datagrid. i grid they are displayed like following
1. Firmname 2. FirmID
Dharmesh
Public Class Firm
Dim _FirmID As Integer
Dim _FirmName As String
Public Property FirmID() As Integer
Get
Return _FirmID
End Get
Set(ByVal value As Integer)
_FirmID = value
End Set
End Property
Public Property FirmName() As String
Get
Return _FirmName
End Get
Set(ByVal value As String)
_FirmName = value
End Set
End Property
End Class
i am binding arraylist of objFirms - i am able to bind it. BUT question is sequence of fields are not correctly displayed in datagrid. i grid they are displayed like following
1. Firmname 2. FirmID
Dharmesh
ASKER
i am not talking about record sorting but column sequence (firm id should come first then firm name should come)
Dharmesh
Dharmesh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Class Firm : System.Collection.ICompare
{
...
public int Compare(object x, object y)
{
// write your comparison result here
}
}
After that, you can use the sort function, e.g.
ArrayList a = new ArrayList();
... // add your firm class here
a.Sort();