Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Cl

J

jorge

Hello

I have the following situation: (everything is dynamic (controls.add))

1. Button.Init {
WasButtonClickFired = true
}

2. TextBox.TextChanged {
WasButtonClickFired?
}

3. ImageButton.Click {
}


I need a way to get the TextChanged event not to fire or at least to know if
the Click event of a button has been fired.

Thanks.
/ jorge
 
G

Guest

I'm not entirely sure of what you're asking, but I have encountered two things which prevent an event handler from dealing with dynamically added control events

1) You need to add the handler. For instance
Suppose I have a table cell 'td' which I want to add a linkbutton to programatically..

Dim lb as new LinkButto
' add all the stuff to the linkbutton..

'Add the handle
AddHandler lb.OnClick, AddressOf me.lbEventHandle

'And the lbEventHandler would be your event handler.

2) Also, look to make sure that you have the controls created again for the postback. If they aren't around after you click on them, the systme won't know what to do

Hope that helps
Andrew Wied
 
J

jorge

Hi Andrew,

There are no problems with the events. They fire as they should. I recreate
them in postbacks and all that.

My question is concerning the fact that TextChanged fires (the event order
is random right?) before a button event I have from a LinkButton. Now, I
need to know if the LinkButton (in this case it's a cancel) has been pressed
so that I can handle my data in the TextChanged event.

I could not use the TextChanged event and instead load the ViewState and
compare old with new to set the new in case there wasnt a Cancel. But the
problem is that would take even more time to implement.

Another solution would be to learn how to be a gardener and change jobs. or
wait for Mono and change it so it works MY way.

Thanks,
/ jorge



Andrew Wied said:
I'm not entirely sure of what you're asking, but I have encountered two
things which prevent an event handler from dealing with dynamically added
control events.
1) You need to add the handler. For instance:
Suppose I have a table cell 'td' which I want to add a linkbutton to programatically...

Dim lb as new LinkButton
' add all the stuff to the linkbutton...

'Add the handler
AddHandler lb.OnClick, AddressOf me.lbEventHandler

'And the lbEventHandler would be your event handler.

2) Also, look to make sure that you have the controls created again for
the postback. If they aren't around after you click on them, the systme
won't know what to do.
 

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

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top