MVP is this a BUG? Adding button element corrupts textbox event!!!

  • Thread starter Thread starter Kathy Burke
  • Start date Start date
K

Kathy Burke

Hi, I posted earlier about my textbox textchanged event no longer
firing. I've found the cause but NOT the reason.

On a fairly simple aspx form, I added an html button to fire a
client-side script of open.window. As soon as this was added, the
textchanged of my textbox no longer fires. I checked that the Handles
part of the sub statement is still there.

EVEN WHEN I DELETE THE NEW BUTTON, the problem remains. I see no code
changes but must revert to a backup to restore the event.

PLEASE HELP...this is serious problem for me.

Thanks.

Kathy
 
Hi

Use the AutoPostBack property to specify whether an
automatic postback to the server will occur whenever the
user modifies the text in the TextBox control and then
tabs out of the control.

Note:Postback only occurs when the text box loses focus
after the contents are changed.

HTH
Ravikanth
 
Thanks for responding...but the autopostback isn't the problem. The
textbox event worked FINE (fired on user hitting <Enter>) until I added
a button control and set the onclick to be an open.window script. I
still need an answer...help!

Kathy
 
After several hours of hair pulling, finally got it working. It was a
combination of things. It would only work if I did NOT use an inline
script in the html button. In the end, for those new users who may have
a similar problem, I did the following:

(1) Added the onclick script in the <head> of the html.

(2) Used an asp:button (vs. html) and put the following code in the page
load sub (if not postback):

buttonname.attributes.add("onclick", "name_of_script();return false;")

the return false will remove/disable the "submit" function that asp.net
adds in runtime.

Kathy
 
Back
Top