Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

When you gotta go,you gotta go !!!!!!!
  • 4 months later...
Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...