473,803 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1575

"Grant" <gp*****@hotmai l.com> skrev i en meddelelse
news:uQ******** ******@TK2MSFTN GP12.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
36686
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 single argument (in this case the file name) to identify which button was clicked. I am using the Command event handler. The link buttons load correctly, but when i click on a link, the event handler code does not execute. Any ideas?
2
3809
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 webpage where the user can enter some search criteria (via dropdowns and textboxes) and then perform a search and have results presented. The results list includes linkbuttons which the user can click on to obtain more detailed results.
10
2858
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 have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
3
3989
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: Cell.Controls.Add(deleteRecipientLink(objReader("NotificationID"))) I feed it with an ID from my database table.
10
4623
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 = i.ToString(); PageLink.Text = "Page " + i;
3
2815
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 to a particular cell in a gridview control. The button appeared where I expected it on the page but when I clicked on it, the button just disappeared. I was in debug mode with a breakpoint set up in my click event handler and the debugger never...
13
10186
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 first order. Likewise if he clicks the second LinkButton, he will be shown the details of the second order he had placed. The Text of the LinkButtons will be 1 2 3 etc. So this user would see 1 2 3 4 5 as the LinkButtons. The problem is...
3
2220
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 pnlLinks.Controls.Add(lnkBut) Next
0
1906
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 table gets successfully displayed on the browser with the LinkButton. When I click on the link button in the browser, my control does not go inside the custom even that I wrote for the link button. I have a table control as ProviderTbl in which...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10289
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7600
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.