Wiring Up Events Nightmare

G

Guest

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
 
N

Nick Stansbury

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
 
J

John Saunders

Eldon Ferran de Pol said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top