我会先将它存储为强类型 List 并将其存储在 Session
Protected Sub Repeater1_ItemDataBound(sender As Object, e As RepeaterItemEventArgs)
Dim repeaterItems As New List(Of Decimal)()
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim b As Button = TryCast(e.Item.FindControl("myButton"), Button)
Dim drv As DataRowView = TryCast(e.Item.DataItem, DataRowView)
repeaterItems.Add(CDec(drv.Row("Price")))
End If
Session("Qprice") = repeaterItems
End Sub
所以我以后可以再次访问它
Dim repeaterItemsFromSession As List(Of Decimal) = DirectCast(Session("Qprice"), List(Of Decimal))