Pressing Enter key in a datagrid

Rattlesnake

Freshman
Joined
Dec 23, 2003
Messages
47
Hi,
I have an ASP.net form , which is a master detail form.
The master section of the form has many textboxes and a Save button.
The detail part is in a Datagrid, that is editable. There is an Edit button in each row , that the use clicks to edit the row. When the row is in edit mode , the row has an Update button.
What I want is that if the user hits the ENTER key while editing a row , it should execute the code that is defined at the click event of the Update button in the row.

Right now what it does is it submits the form when the user presses the ENTER key. How can I stop it from doing this , and execute the Update button code.

Note: When the user presses the enter key while in the master section of the form , I dont want the form to be submitted.

Thanks
 
try this?

<body MS_POSITIONING="FlowLayout" onkeydown="if(event.keyCode == 13){return false;}">

it sez, if the user hits enter on the page, then do nothing.

good: keeps people from submitting by mistake

bad: cannot do carriage return in a multiline textbox, nor use the enter key for button click events

cheers!
 
Back
Top