[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Pierluigi

10/17/2002 9:23:00 PM

Hi,
I'm in trouble creating a vector of objectlists (in this example filled
with then same data), here're some questions:
1. My table has two rows in listview, the others should be visible in
detailview, but no details panel seems to exist (click on a item takes me to
a blank page)
2. I've tried adding a ItemSelectEventHandler with addhandler, but it didn't
work (I've noted that if I debug my application with a breakpoint set in my
ObjectList_ItemSelect sub, it does not executes.Why?)
).
Here's the code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then

Dim al As ArrayList = New ArrayList()

al.Add(New TeamStats("Inter", 4, 0, 0))
al.Add(New TeamStats("Milan", 3, 1, 0))
al.Add(New TeamStats("Juventus", 2, 2, 0))
al.Add(New TeamStats("Lazio", 1, 2, 1))

Dim p As MobileControls.Panel
Dim ol As MobileControls.ObjectList
Dim fldName As MobileControls.ObjectListField = New
MobileControls.ObjectListField()
Dim fldWon As MobileControls.ObjectListField = New
MobileControls.ObjectListField()
Dim fldDrawn As MobileControls.ObjectListField = New
MobileControls.ObjectListField()
Dim fldLost As MobileControls.ObjectListField = New
MobileControls.ObjectListField()
Dim fldPoints As MobileControls.ObjectListField = New
MobileControls.ObjectListField()

fldName.Name = "Name"
fldName.DataField = "Name"
fldWon.Name = "Won"
fldWon.DataField = "Won"
fldDrawn.Name = "Drawn"
fldDrawn.DataField = "Drawn"
fldLost.Name = "Lost"
fldLost.DataField = "Lost"
fldPoints.Name = "Points"
fldPoints.DataField = "Points"

Dim ts As TeamStats

For Each ts In al

ol = New MobileControls.ObjectList()

AddHandler ol.ItemSelect, New
MobileControls.ObjectListSelectEventHandler(AddressOf ObjectList_ItemSelect)

ol.DataSource = al
ol.TableFields = "Name;Points"

ol.Fields.Add(fldName)
ol.Fields.Add(fldWon)
ol.Fields.Add(fldDrawn)
ol.Fields.Add(fldLost)
ol.Fields.Add(fldPoints)

ol.DataBind()

p = New MobileControls.Panel()
p.Controls.Add(ol)
frmDefault.Controls.Add(p)

Next

End If
End Sub

Private Sub ObjectList_ItemSelect(ByVal sender As System.Object, ByVal e
As System.Web.UI.MobileControls.ObjectListSelectEventArgs)

Dim o As MobileControls.ObjectList = e.ListItem.Parent
o.ViewMode = MobileControls.ObjectListViewMode.Details

End Sub

End Class

Public Class TeamStats

Private _name As String
Private _won As Integer
Private _drawn As Integer
Private _lost As Integer
Private _points As Integer

Public Sub New(ByVal name As String, ByVal won As Integer, ByVal drawn
As Integer, ByVal lost As Integer)

_name = name
_won = won
_drawn = drawn
_lost = lost
_points = _won * 3 + _drawn

End Sub

Public ReadOnly Property Name() As String
Get
Return _name
End Get
End Property

Public ReadOnly Property Won() As Integer
Get
Return _won
End Get
End Property

Public ReadOnly Property Drawn() As Integer
Get
Return _drawn
End Get
End Property

Public ReadOnly Property Lost() As Integer
Get
Return _lost
End Get
End Property

Public ReadOnly Property Points() As Integer
Get
Return _points
End Get
End Property

End Class

thanks in advance