T
Tony
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.
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.