I wish to remove all item in my session, how do I do that? I have tried to use the code below, but this generates an error. It's the code in the Sub Fjern(..)
Code:sub page_load() if not page.IsPostback then Session("BasketCount") = New ArrayList() Dim vareArray(5) as string Dim strVare as String vareArray(0) = "Kartofler" vareArray(1) = "Gulerødder" vareArray(2) = "Æbler" vareArray(3) = "Appelsiner" vareArray(4) = "Pærer" vareArray(5) = "Agurker" for each strVare in vareArray drpList.items.add(strVare) next end if end sub public Sub Fjern(sender As Object, e As EventArgs) dim i as integer dim j as integer j = session("basketCount").count - 1 i = 1 For i=1 to j Session("BasketCount").RemoveAt(i) i = i + 1 Next vareListe.text = "" End Sub




Reply With Quote