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

Expert advice needed on some strange event handling

I have a WebApp with 3 text boxes and 1 button, as described below. Can
someone please explain why the bad scenarios are occurring and

better still if they can be prevented or worked-around? Please excuse my
lengthy message.
+++ Web Form Structure +++

[TextBox1] TextChanged event wired up.
[TextBox2] TextChanged event wired up and property AutoPostBack=True.
[TextBox3]
<Button1> Click event wired up and property AccessKey=B.
+++ Scenario A +++

[a ] press tab key
[b ] press tab key <- post back occurs here
[ ]
<Button1>

Server Event Trace:
TextBox1_TextChanged
TextBox2_TextChanged

Good Result:
Couldn't ask for anything more here :)
+++ Scenario B +++

Note: This scenario also occurs by pressing the Button1's AccessKey (alt+B)
instead of pressing the enter key.

[c ] press tab key
[d ] press enter key <- post back occurs here
[ ]
<Button1>

Server Event Trace:
TextBox1_TextChanged
TextBox2_TextChanged
TextBox1_TextChanged
TextBox2_TextChanged
Button1_Click

Bad Result:
TextBox1&2_TextChanged events fired twice. This is probably because of two
seperate post backs (TextBox2's AutoPostBack=True

and button's Click). Is there a way of avoiding two TextChange events from
occuring? Setting AutoPostBack=False is not an option.
+++ Scenario C +++

[e ] press tab key
[f ]
[ ]
<Button1> click <- post back occurs here

Server Event Trace:
TextBox1_TextChanged
TextBox2_TextChanged

Bad Result:
Missing Button1_Click event. This could potentially be a problem if there's
no work-around. Any suggestions here?
Many thanks in advance,
Tony.
May 24 '06 #1
3 1371
I'd better summarise my previous lengthy message - even I'm getting confused
:)

1. When a web form has a text field with AutoPostBack=True, we seem to be
getting twice the number of post backs on the TextChanged event - refer to
scenario B.
2. There are situations when a button click event is missed when a web form
has a text field with AutoPostBack=True - refer to scenario C.

Does anyone know of any work-arounds addressing these two scenarios?

Thanks
May 24 '06 #2
Hello Tony. My advice is to not use the AutoPost Back event on a text box.
You really shouldn't be doing that as it is a) very server /network consuming
and b) it can frustrate the user on many levels. If you can try to explain
what you are trying to accomplish with the auto post backs and the button
clicks I can try to see if there are ways around this or iuf there are easy
js methods that can do what you are trying to do.

Hope this helps.

"Tony" wrote:
I'd better summarise my previous lengthy message - even I'm getting confused
:)

1. When a web form has a text field with AutoPostBack=True, we seem to be
getting twice the number of post backs on the TextChanged event - refer to
scenario B.
2. There are situations when a button click event is missed when a web form
has a text field with AutoPostBack=True - refer to scenario C.

Does anyone know of any work-arounds addressing these two scenarios?

Thanks

May 24 '06 #3
Thanks for replying.

AutoPostBack's on text fields were a matter of convenience on the user's
behalf. In order for certain validation logic to be performed, it saved them
the trouble of pressing a button after text was changed in the field. Under
some conditions, validating a text field right after it's been edited (user
leaves the field) can also be a blessing, in that it may save the user
completing the entire form and hitting the submit button to only realise
that the text field cannot be accepted. And possibly worst the context of
the entire form is now void and they may have to redo it all again in a
different context.

I guess there are work-arounds in these extreme situations by turning
AutoPostBack's off by have an explicit button next to the field staing the
obvious "Validate Entry Now". But if the two bad scenarios (B & C) could be
resolved by having AutoPostBack's on, then that would be my preferred
resolution.

Tony

<re****@community.nospam> wrote in message
news:A8**********************************@microsof t.com...
Hello Tony. My advice is to not use the AutoPost Back event on a text box.
You really shouldn't be doing that as it is a) very server /network
consuming
and b) it can frustrate the user on many levels. If you can try to explain
what you are trying to accomplish with the auto post backs and the button
clicks I can try to see if there are ways around this or iuf there are
easy
js methods that can do what you are trying to do.

Hope this helps.

"Tony" wrote:
I'd better summarise my previous lengthy message - even I'm getting
confused
:)

1. When a web form has a text field with AutoPostBack=True, we seem to be
getting twice the number of post backs on the TextChanged event - refer
to
scenario B.
2. There are situations when a button click event is missed when a web
form
has a text field with AutoPostBack=True - refer to scenario C.

Does anyone know of any work-arounds addressing these two scenarios?

Thanks

May 26 '06 #4

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

Similar topics

0
by: Gonçalo Rodrigues | last post by:
Hi, I have a problem with threads and sockets. I'll try to describe the problem in words with pseudo-code. I've been working on a few classes to make it easier to work with threads. This...
7
by: John Smith | last post by:
Hi All, Sorry if I am calling expert's advice on such a simple thing. I am reading a c++ code but do not understand what this means? #define DM_ITEMS 6 #define FM_ITEMS ( 1 << (DM_ITEMS -...
3
by: Wendell III | last post by:
Meetroduction (Meetro) is looking for a full-time JavaScript expert. Chicago-based startup seeks an experienced, dedicated and energetic JavaScript programmer to develop components of a robust,...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
3
by: apattin | last post by:
Hi all, I need some expert advice on a ROLLUP fine point. summary_table table has 4 columns: file_id primary_site morphology primary
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
3
by: MIUSS | last post by:
Hi! I am modifying some part of source code and I now I am suspended by one thing I really don't understand and I got no one experience with it. I got fully working source code (it reports no...
3
by: Peter Webb | last post by:
When I started my current extremely graphics intensive project, I ignored advice in this ng to use the Paint method, and used the alternate CreateGraphics approach. I thought there were some good...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.