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

Wiring Up Events Nightmare

I'm trying the dynamically wire up events for a load of LinkButtons contained
within an <asp:Table>. For some reason if I try and do this outside the
Page_Load event my events simply don't fire despite the correct postback code
being added on the client and the postback taking place.

Can anyone help please?

Eldon
Nov 19 '05 #1
2 1355
Hi,
The events need to be wired up at the correct place in execution
sequence.

ie. if you add the handler for the LinkButton_Click event in the code of
SomeOtherSub then the event isn't wired up when the .net engine looks for an
event handler for the linkbutton's click event:

Page_Load
LinkButton_Click
SomeOtherSub

Does this make sense? I'm sure that someone who knows their stuff could
explain this a lot better than I can - the basic point is that you need to
wire up your events dynamically before the event handler is called in the
sequence. Page_load is the obvious place to do this

Nick

"Eldon Ferran de Pol" <El**************@discussions.microsoft.com> wrote in
message news:EA**********************************@microsof t.com...
I'm trying the dynamically wire up events for a load of LinkButtons contained within an <asp:Table>. For some reason if I try and do this outside the
Page_Load event my events simply don't fire despite the correct postback code being added on the client and the postback taking place.

Can anyone help please?

Eldon

Nov 19 '05 #2
"Eldon Ferran de Pol" <El**************@discussions.microsoft.com> wrote in
message news:EA**********************************@microsof t.com...
I'm trying the dynamically wire up events for a load of LinkButtons
contained
within an <asp:Table>. For some reason if I try and do this outside the
Page_Load event my events simply don't fire despite the correct postback
code
being added on the client and the postback taking place.


Try to wire them up during Page_Init. That's what VS.NET generates for a C#
program if you add the events in the designer.

John Saunders
Nov 19 '05 #3

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

Similar topics

2
by: Kate | last post by:
I am learning VB by working on an existing application. It is dawning on me that this particular program was not designed very carefully, and I have come to the point where I have to deal with...
1
by: Scott M | last post by:
I'm building a smart client application based off of the example that is posted on windowsforms.com (and shown on the .NET show). A windows form calls a webservice that itterates through a...
0
by: Chris Fink | last post by:
I am writing a c# unattended windows application and I would like to write an event to handle any type of application error by gracefully degrading and writing a message to an error log. Errors...
0
by: Robert W. | last post by:
Though I'm new to C#, I've successfully built an MVC (Model-View-Controller) Framework - with much thanks to the help of the great people on here! Anyhow, my MVC Framework, which I call "ASM" for...
3
by: Robert W. | last post by:
I have several instances where I wire up an event handler like this: // Instantiate object childClass parentObject = new childClass(); // Wire up event parentObject.SomeChildEvent += new...
4
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
5
by: Andrew Robinson | last post by:
I have a page that can load a number of different user controls. Each of these user controls inherits from a common base class and the controls are loaded based on application state, status, etc...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
1
by: spoonybard | last post by:
Hi Everyone, Recently, when I was trying to wire up an event for a GridView inside an AJAX Accordion, I was doing the wiring up in the code behind. The event never fired. When I moved that...
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
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,...
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,...

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.