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

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
 
R

Ravikanth[MVP]

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
 
K

Kathy Burke

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
 
K

Kathy Burke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top