473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

LinkButton event handler and Page_Load problem

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
Nov 17 '05 #1
1 1559

"Grant" <gp*****@hotmail.com> skrev i en meddelelse
news:uQ**************@TK2MSFTNGP12.phx.gbl...
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?
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: CodeRazor | last post by:
I am creating an aspx page using C# and would like to be able to dynamically create linkbuttons that all run the same fuction on the click event. However, I would like the function to accept a...
2
by: Peter Kirk | last post by:
Hi are there any "gotchas" with using an asp:repeater that means that the "onclick" method of a LinkButton created in the repaeter does not fire? I at least cannot get it to work. I have a...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
3
by: Rob Meade | last post by:
Hi all, I have a bit of code that programmatically adds some table cells/rows to a table. The last cell adds a LinkButton control, I call it like this: ...
10
by: Vi | last post by:
Hi, I'm trying to dinamically add LinkButton Controls to a web form. I do something like: for(i=1;i<=someVariable;i++) { LinkButton PageLink = new LinkButton(); PageLink.CommandName =...
3
by: Gabe | last post by:
Hi there, The other day I tried to programmatically create an asp.net linkbutton during my Page_Load() event and attach a click event handler to the linkbutton, then add that linkbutton control...
13
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his...
3
by: rn5a | last post by:
Consider the following code which creates LinkButtons dynamically: For i = 1 to 5 lnkBut = New LinkButton lnkBut.ID = "lnkBut" & i lnkBut.Text = i.ToString & " " lnkBut.CommandName = i...
0
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.