A frustrating problem. Help greatly appreciated! :-(


Simon Harvey


I'm hoping someone can help me witht he following problem:

I have a fairly simple page that has a sort form and a button for adding the
forms details to an arraylist.

When the button is pressed, the information from the form needs to be added
to a list in the bottom half of the page.

The problem I am having is to do with persisting the array and displaying
the list.

When the button is pressed I am adding the information to the array and
adding the array to the Session.

In page load, I am reading from the session and displaying the info in the

The problem is, the pageload event happens BEFORE the button click event, so
the new data isn't added to the array until after page load has run. Which
is rubbish!

Does anyone know how I can fix this or do it in a different way to get the
right result?

Thanks to anyone who can help

Kindest Regards





What you probably want to do is something like this

function DisplayListAtBottomofPage()
... code to display list a tbottom of page goes here from the session

Page_Load (...)
if (IsPostBack==false) { DisplayListATBottomOfPage(); } // this only
fires if we are not postingback aka a button was not pressed
// Add Item to array
// Save Array in the Session


Hope this helps. Posting is provided as is