LinkButton event handler and Page_Load problem

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

The Idea:
Page1.aspx sets a property value to an arraylist.
Page2.aspx retreives that property (using a Context.Handler) every time the
page loads. It then iterates through the arraylist and builds a table
containing dynamically created LinkButtons. These LinkButtons have an event
handler.

The problem:
When I click one of these linkbuttons, the page re-initialises and calls the
Page_Load event. At this point that arraylist is lost and the system crashes
because the requesting page is no longer Page1.aspx and therefore I cannot
use the Context.Handler anymore.

The Question:
What do I do to keep that arraylist alive so the system can re-build those
controls and fire the event? Or what else can I do to get around this
problem? Ive tried retreiving the arraylist from Page2.aspx but it is out of
scope when I try retrieve it.

I can post code if this sounds confusing.

Apologies if this is the wrong newsgroup, Ill accept the flaming.
Grant
 
Grant said:
The Idea:
Page1.aspx sets a property value to an arraylist.
Page2.aspx retreives that property (using a Context.Handler) every time
the page loads. It then iterates through the arraylist and builds a table
containing dynamically created LinkButtons. These LinkButtons have an
event handler.

The problem:
When I click one of these linkbuttons, the page re-initialises and calls
the Page_Load event. At this point that arraylist is lost and the system
crashes because the requesting page is no longer Page1.aspx and therefore
I cannot use the Context.Handler anymore.

The Question:
What do I do to keep that arraylist alive so the system can re-build those
controls and fire the event? Or what else can I do to get around this
problem? Ive tried retreiving the arraylist from Page2.aspx but it is out
of scope when I try retrieve it.

I can post code if this sounds confusing.

A shot in the dark (I'm not sure what your doing, and gui/aspx stuff is not
me): can you use !IsPostBack in your Page_Load?
 
Back
Top