尝试在itemDatabound期间访问listview中的上一个项目,但它不返回任何内容。实际上,lvListview.items.count显示为0;即使记录显然在那里。
谢谢你的任何帮助。 :)
Protected Sub lvReleaseNotesReport_ItemDataBound(sender As Object, e As ListViewItemEventArgs) Handles lvReleaseNotesReport.ItemDataBound
If e.Item.ItemType = ListViewItemType.DataItem Then
Dim relNote As ReleaseNotesDTO = DirectCast(e.Item.DataItem, ReleaseNotesDTO)
If e.Item.DataItemIndex > 0 Then
Dim prevNote As ReleaseNotesDTO = DirectCast(lvReleaseNotesReport.Items(e.Item.DataItemIndex - 1).DataItem, ReleaseNotesDTO)
'prevNote keeps coming up as Nothing
End If
'do other stuff with relNote and prevNote...
End If
End Sub
也试过这个,......
Protected Sub lvReleaseNotesReport_PreRender(sender As Object, e As EventArgs) Handles lvReleaseNotesReport.PreRender
For Each item As ListViewItem In lvReleaseNotesReport.Items
If item.ItemType = ListViewItemType.DataItem Then
If item.DataItemIndex > 0 Then
Dim thisNote As ReleaseNotesDTO = DirectCast(item.DataItem, ReleaseNotesDTO)
Dim prevItem As ListViewDataItem = lvReleaseNotesReport.Items(item.DataItemIndex - 1)
Dim prevNote As ReleaseNotesDTO = DirectCast(prevItem.DataItem, ReleaseNotesDTO)
'do other stuff with relNote and prevNote...
End If
End If
Next
End Sub
在单步执行代码时,鼠标悬停在lvReleaseNotesReport.Items上会显示正确的记录计数,但所有数据项都是=无。
答案 0 :(得分:0)
非常感谢,我明白了。 DataKeyNames和DataKeys索引。
{{dataProperty}} <input type="text" [ngModel]="dataProperty"></input>