preventing carriage return from causing postback

S

Steve

I have a simple form with a textbox and a command button,
both web form controls (not raw HTML controls). I notice
that when the user enters text in the textbox and hits
carriage return, the form posts back. Is there a way to
prevent this?

I think it is undesirable for two reasons
1) Developer must support re-rendering the page even if
no events fire, which is another path through the code to
worry about (not always trivial if viewstate isn't being
used)
2) May be confusing to the user who will assume hitting
return is the equivalent of clicking some default button;
it isn't, because no events fire

Any suggestions would be welcome.
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top