473,418 Members | 1,965 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,418 software developers and data experts.

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 2165
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aymer | last post by:
i created a new button object. how do i attach an event on it? thanx for your help. Dim cc As ColorConverter = new ColorConverter() Dim b = new button() b.ID = "SelectedDate" b.BorderStyle...
4
by: Anatoly | last post by:
Put any control on web page. create Init event for ths control. Write Response.Write("here") inside this event. Compile\build\run. I never saw "here" string appear on web page. Why???
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
1
by: Spencer H. Prue | last post by:
I have a textbox and a button on my asp.net form. I have some Smtp code in my button click procedure. When the user hits the return for the textbox the button procedure runs. When the button is...
2
by: moi | last post by:
Hello, i would like a sample code to call a button click with the event "textchanged" of a textbox. I just would like to valide a textbox with the textchanged event and not to click on the submit...
0
by: moi | last post by:
Hello, I have a formview with a textbox and a button with an Insert commandname. I have put a textchanged event without a autopostback and i see that when i click the button, the textchanged's...
3
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username...
5
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
5
by: S_K | last post by:
This is a weird problem.. I have a page with a textbox and a button (along with a bunch of other stuff). Both the textbox and the button have their SEPERATE events defined for the textchanged...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...

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.