DataGrid, Edit and the Enter Key

N

Newbie

Hi Everyone,

ASP.NET 1.x

I have a problemette !

I have a datagrid on my web form. When the user hits the enter key whilst
any editable field on the form including those in the datagrid itself, it
triggers a submit back to the server.

A the least, I want to disable this and at best, I want to know if I can
trap the enter key for the currently being edited row on the datagrid to
force and update event of that line.

Can anyone help ?
 
S

S. Justin Gengo [MCP]

Newbie,

I have a javascript component on my website and one of the scripts is used
to trap the enter key while in a textbox and click the button of your
choice. It will be a bit more difficult to do in a datagrid since you'll
have to use the OnItemDatabound event to hook up the script properly. The
component is free and comes with all source code. For your use I would
suggest stripping out just the code you need and using it as an example.
Also in my code library if you do a search for "Clickable Datagrid" I have
an example of how to make a datagrid row clickable for selecting it. You
won't need that, but it does show how to hook up a javascript to the
datagrid's select button from within OnItemDatabound. That example should be
helpful for doing this. You may find a demo and link to download the
javascript component here: http://www.aboutfortunate.com?page=javascriptdemo


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

S. Justin Gengo [MCP]

Newbie,

If you have any questions feel free to email me.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
N

Newbie

I have a different question regarding user controls which I have just posted
to the group, if you wouldnt mind taking a look at that I would appriciate
it.

Thanks
 

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

Top