User control TextBox posting issue

T

tp

I have a web form that has a number of user controls on it. One of
them, a header user control that appears at the top of all our pages,
has a text box and a link button for searching.

This text box/link button combo works just fine, except when the user
hits Enter and there is no data in the text box. If there is ANY text
in the text box, it fires the link button when the user hits Enter and
everything is peachy. If the search text box is blank, it does a
postback for the form in the parent page (the page containing the user
control) and essentially just reloads the page (generally causing
things to look all wrong).

I can post code for this, but it's going to take me an hour to unic
the code to a level where I'll be posting only relavant code, so I'd
like to initially find out if anyone is aware of a bug / anything that
causes this type of behavior (where it works fine with text in the
box, but not when it's blank).

I'm not even sure if the bug is that it's working the way I want it
when there is text in the box - that could be the behavior that's not
correct, and it perhaps should always submit the form from the parent
page?

In any case, can someone give me an idea of how they would handle this
situation? I have put JavaScript on the client-side of the form to
grab the keypress and examine it for the Enter key, and when it's hit,
I call the .click() event of the link button, but it still doesn't
work when there is no data in the text box (the event handler for the
link button's Click() event doesn't get fired).

Thanks
-
tp
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top