Enter key in datagrid

  • Thread starter Stephen J. Shephard
  • Start date
S

Stephen J. Shephard

Hi there,
I know this is probably a 101-type question, and I've dealt with it using
client script blocks before, but I'm curious about what the best way to
handle the enter key is.. (i.e., to handle it when it generates a postback).

In my particularly frustrating situation, I have a master-detail type
datagrid/form page, and when the user hits the enter key, the form is
submitted and the first record in the master grid gets deleted. I'm assuming
this is because the enter key is submitting the form and what, assuming a
'Delete' command name or something? The only way a record can get deleted is
by using my 'ondeletecommand' event handler.. My datagrid has four columns,
the first being a linkcommand with an 'edit' command name, the second and
third are simple labels, and the fourth is an image button with a 'delete'
command name.

Does anyone have any advice, not necessarily for the particular nuance of my
problem, but just in general, how to handle the enter key? I've seen some
examples on the web with people building their own datagrid controls that
inherit from the datagrid, adding functionality to handle the enter key, but
this is a bit much for what I'm trying to do. Surely there's a better way to
handle the enter key than building a new control..?

Any ideas?

Thanks,
S
 
J

Jeffrey Tan[MSFT]

Hi Stephen,

I have viewed that this post has been posted in several groups. I have
added a reply to you in
microsoft.public.dotnet.framework.aspnet.datagridcontrol, please follow up
there. I will help you.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top