views:

963

answers:

2

I've been chasing this one around for a couple of days and it's starting to drive me a bit batty.

I have a text box on a Gridview which I'm allowing some data to be edited. When the enter key is hit, the TextChanged event happens, like I'd expect, but then it also fires the OnClick event of a button on the form.

I tried removing the button and it just moves to the next button on the form, so there's something about this that's making it think the enter key is pressing the button.

I've tried to Google it, but I'm not seeing much. I tried searching here, but it seems to be unusual enough that my search terms aren't catching it. :-) Any help or suggestions would be most welcome. Thanks.

Bob

A: 

Your buttons have properties called IsCancel and IsDefault. If you disable them it will solve your issue.

Those properties allow a button to be treated as the default action for clicking the enter and escape keys.

sipwiz
+1  A: 

Try setting the UseSubmitBehavior="False" on the buttons on your page.

J.13.L
That's got it. Thanks! Now I have a couple of imagebuttons that I need to adjust since they don't have these properties.
BobC