preventing carriage return from causing postback

  • Thread starter Thread starter Steve
  • Start date Start date
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.
 
Back
Top