470,635 Members | 2,299 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,635 developers. It's quick & easy.

Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl.

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

Nov 18 '05 #1
2 2040
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
Nov 18 '05 #2
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" <an*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
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.
Hope that helps,
Andrew Wied

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Aymer | last post: by
4 posts views Thread by Anatoly | last post: by
4 posts views Thread by Mark Lingen | last post: by
3 posts views Thread by Robert W. | last post: by
5 posts views Thread by rn5a | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.