all groups > dotnet academic > march 2007 >
You're in the

dotnet academic

group:

Cannot store arraylist in session - Please help


Cannot store arraylist in session - Please help ricardo.sobral.santos NO[at]SPAM googlemail.com
3/29/2007 12:14:40 AM
dotnet academic:
Hi there,

I cannot store an arraylist in a session. I have read some posts and
still found no solution. I am sure it might be something simple, but
since I have been around it for quite sometime I ask for your advice.

Here is my page load.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Not Page.IsPostBack Then
Dim users As New ArrayList
users = User_.ArrayOfUsers ' This gets an array of
users. (User_ is just an object)
Session.Add("users", users)
Session.Add("i", 0)

i = 0
details =
User_.UserID_Image_Thumbnail_LastCheck_Rating_NumberOfVotes(users.Item(i))
Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(3).ToString
details.Clear()
users.Clear()
Else
i = CType(Session("i"), Integer)
Dim users_tmp As New ArrayList
users_tmp = CType(Session("users"), ArrayList) ' Why is
this empty?!?! I cannot understand...

detailsAfterRating =
User_.UserID_Image_Thumbnail_LastCheck_Rating_NumberOfVotes(users_tmp.Item(i))
details =
User_.UserID_Image_Thumbnail_LastCheck_Rating_NumberOfVotes(users_tmp.Item((i
+ 1)))

Image.ImageUrl = details(1).ToString
lblLastChecked.Text = details(2).ToString

RatedImage.ImageUrl = detailsAfterRating(2).ToString
lblRating.Text = detailsAfterRating(5).ToString
lblPastRate.Text = yourRating.ToString
i = (i + 1)
Session.Add("i", i)
details.Clear()
detailsAfterRating.Clear()
End If
End Sub
Re: Cannot store arraylist in session - Please help pvdg42
3/29/2007 7:23:12 AM
I'm going to try to crosspost this to the ASP.NET group.

[quoted text, click to view]

Re: Cannot store arraylist in session - Please help bruce barker
3/29/2007 8:27:14 AM
after adding a ref to users to session, you call users.Clear() to clear
it, so on postback its empty.

-- bruce (sqlwork.com)

[quoted text, click to view]
AddThis Social Bookmark Button