473,406 Members | 2,343 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,406 software developers and data experts.

Keep an arraylist alive between Page_Load

Hi, Im using C# in a web solution - I have a bunch of LinkButtons that are
dynamically created on my page according to an arraylist. My understanding
is that When I click one of those linkbuttons at runtime, the page has to
load again and those conrtrols have to be re-created before the click event
can be handled. The problem Im having is that the arraylist I originally
used to build the controls, is not available anymore. How do I keep this
arraylist alive? Or whats a more efficient way to build these controls?
Heres what Im doing:

private void Page_Load(object sender, System.EventArgs e){
//When the page first loads I use a context handler to get the arraylist
from the calling page:
if (!IsPostBack){
DummyRun sourcepage = (DummyRun) Context.Handler;
ArrayList objResultsArray = sourcepage.DummyRunResults;
Buildtable();
}
}

Thanks,
Grant
Nov 17 '05 #1
1 1236
Hi,

You have to recreate them indeed, the easier solution is to store the list
in Session
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Grant" <gp*****@hotmail.com> wrote in message
news:OP**************@tk2msftngp13.phx.gbl...
Hi, Im using C# in a web solution - I have a bunch of LinkButtons that are
dynamically created on my page according to an arraylist. My understanding
is that When I click one of those linkbuttons at runtime, the page has to
load again and those conrtrols have to be re-created before the click
event can be handled. The problem Im having is that the arraylist I
originally used to build the controls, is not available anymore. How do I
keep this arraylist alive? Or whats a more efficient way to build these
controls? Heres what Im doing:

private void Page_Load(object sender, System.EventArgs e){
//When the page first loads I use a context handler to get the arraylist
from the calling page:
if (!IsPostBack){
DummyRun sourcepage = (DummyRun) Context.Handler;
ArrayList objResultsArray = sourcepage.DummyRunResults;
Buildtable();
}
}

Thanks,
Grant

Nov 17 '05 #2

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

Similar topics

1
by: David | last post by:
This is called "evil hack problem" because my problems are due to me trying to do an evil hack. Please don't judge me, just believe that there are reasons for what I'm trying to do :-) I've got...
4
by: Stephen | last post by:
I have got an event below to remove items from an arraylist and then to rebind the arraylist to the datagrid subsequently deleting the appropriate row. My problem is that my code makes sense and I...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
1
by: cppdev | last post by:
Hello, After reading a few articles, http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/e55664b4-6471-48b9-b360-f0fa27ab6cc0...
3
by: Jim Corey | last post by:
I'm trying to save some ArrayLists to viewstate and then use them as DataSources for dropdownboxes. The code looks like this: 'DptList is a arraylist variable local to this procedure ...
8
by: Patrick.O.Ige | last post by:
Hi All, I have a code below:- That Binds a DropDownList to a database using ArrayList. This code works well in ASP.NET webMatrix. But when i use it below in VS.NEt it gives me the error:-...
1
by: Nuno Magalhaes | last post by:
With the sniffer ethereal I get a lot of Connections Keep Alive in some sites like google.com and that returns me the Content-Length in the HTTP response header. When the connection is Close I...
7
by: mail747097 | last post by:
I would like to keep IIS alive on my web site and prevent Application_End from occuring in global.asax. Any ideas?
0
by: richard.krehbiel | last post by:
I've been googling for half a day now and have found answers on both sides of the argument. Baiscally it's this: I am using PHP 5.0.4 (I can upgrade if that's a solution) as an ISAPI module under...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.