AutoPostBack syntax error

  • Thread starter Thread starter webdeveloper
  • Start date Start date
W

webdeveloper

<asp:TextBox ID="SifraDokumenta" runat="server" OnTextChanged="OnTextChanged"
autopostback="True">

when using autopostback="true" sytax error fires on page load in ie7 but not
in firefox!

Code generated in browser:
<input name="SifraDokumenta" type="text"
onchange="javascript:setTimeout('__doPostBack(\'SifraDokumenta\',\'\')', 0)"
onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;"
id="SifraDokumenta" />

Target framework 3.5 sp1
win 2003 sp2
 
<asp:TextBox ID="SifraDokumenta" runat="server"
OnTextChanged="OnTextChanged" autopostback="True">

when using autopostback="true" sytax error fires on page load in ie7
but not in firefox!

Code generated in browser:
<input name="SifraDokumenta" type="text"
onchange="javascript:setTimeout('__doPostBack(\'SifraDokumenta\', \'\')'
, 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false)
return false;" id="SifraDokumenta" />

Target framework 3.5 sp1
win 2003 sp2

Auto posting on a textbox with the text changed is asking for trouble,
as every single character typed fires the event. It could be that
firefox is not catching the character hit the same way and allowing you
to finish, but I am guessing that IE7 is firing the event multiple times
as the person types in characters. Unless this box only accepts one
character, I would use a button or something similar to handle the
changes you require.


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
I have a form with one ASP.net listbox control and three ASP.net button controls. The former is set to AutoPostBack (i.e. when user selects an item), and the three button are also submit buttons.

This works perfectly in Firefox, and Page.IsPostBack is true in the Page_Load routine.

But in IE8 and Chrome Page.IsPostBack is false whenever any of the 4 is used to submit the form.

I've checked the generated Javascript in all 3 browsers, and it's identical.

What gives ? I'm completely stumped by this :-(

(Running ASP.net 3.5 sp1 on Win2003 x64)

Cheers.




Gregory A. Beamer wrote:

=?Utf-8?B?d2ViZGV2ZWxvcGVy?
28-Jul-09

\'\')

Auto posting on a textbox with the text changed is asking for trouble
as every single character typed fires the event. It could be tha
firefox is not catching the character hit the same way and allowing yo
to finish, but I am guessing that IE7 is firing the event multiple time
as the person types in characters. Unless this box only accepts on
character, I would use a button or something similar to handle th
changes you require

-
Gregory A. Beame
MVP; MCP: +I, SE, SD, DB

Twitter: @gbworl
Blog: http://gregorybeamer.spaces.live.co

******************************************
| Think outside the box!
*******************************************

Previous Posts In This Thread:

AutoPostBack syntax error
<asp:TextBox ID="SifraDokumenta" runat="server" OnTextChanged="OnTextChanged
autopostback="True"

when using autopostback="true" sytax error fires on page load in ie7 but no
in firefox

Code generated in browser
<input name="SifraDokumenta" type="text
onchange="javascript:setTimeout('__doPostBack(\'SifraDokumenta\',\'\')', 0)
onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;
id="SifraDokumenta" /

Target framework 3.5 sp
win 2003 sp2

=?Utf-8?B?d2ViZGV2ZWxvcGVy?
\'\')

Auto posting on a textbox with the text changed is asking for trouble
as every single character typed fires the event. It could be tha
firefox is not catching the character hit the same way and allowing yo
to finish, but I am guessing that IE7 is firing the event multiple time
as the person types in characters. Unless this box only accepts on
character, I would use a button or something similar to handle th
changes you require

-
Gregory A. Beame
MVP; MCP: +I, SE, SD, DB

Twitter: @gbworl
Blog: http://gregorybeamer.spaces.live.co

******************************************
| Think outside the box!
*******************************************


Submitted via EggHeadCafe - Software Developer Portal of Choice
Dr. Dotnetsky's Cool .Net Tips and Tricks No. 26
http://www.eggheadcafe.com/tutorial...be30-cde5d852348d/dr-dotnetskys-cool-net.aspx
 
Back
Top