473,809 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=Tr ue.
[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_TextCh anged
TextBox2_TextCh anged

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_TextCh anged
TextBox2_TextCh anged
TextBox1_TextCh anged
TextBox2_TextCh anged
Button1_Click

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

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

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

Server Event Trace:
TextBox1_TextCh anged
TextBox2_TextCh anged

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 1388
I'd better summarise my previous lengthy message - even I'm getting confused
:)

1. When a web form has a text field with AutoPostBack=Tr ue, 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=Tr ue - 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=Tr ue, 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=Tr ue - 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****@communi ty.nospam> wrote in message
news:A8******** *************** ***********@mic rosoft.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=Tr ue, 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=Tr ue - 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
1452
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 framework, let us call it that, consists in two parts. The first part is just a basic thread class deriving from threading.Thread with a few extra functionality that makes it easier for a thread to spawn a new thread and "father it". Each of its
7
2344
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 - 1) ) when I look at the value of FM_ITEMS in my debug log it is 32.
3
1638
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, browser-hosted social networking application. You must have very strong AJAX-Object Oriented JavaScript skills, intimate knowledge of the DOM and experience developing XML driven applications using JavaScript. This position requires excellent...
1
9667
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
3
4840
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
1729
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 (derived from System.Web.UI.Page). So, for instance, my home page's inheritance chain looks like this: HomePage Inherits WebPageBase
232
13385
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 set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
3
1944
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 one error when compile). The problem is that there are some variables used as arguments for some functions but they are NOT declared. I was trying to find theirs declarations but I didn't find them. I even tried to find theirs assignments but I...
3
1551
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 reasons for that, which I won't go into. Anyway, there has always been one tiny bug that has annoyed me - the code that draws the initial graphic image into PictureBox1 will only work if wire it up to a button, it doesn't actually do anything if...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.