This is a migrated thread and some comments may be shown as answers.

Radgrid Edit Mode - Capture Enter Key and Fire Update

11 Answers 621 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MikeK
Top achievements
Rank 1
MikeK asked on 12 Mar 2009, 08:05 PM
How do I do this? 

If I have a grid that the user entered edit or insert mode, I want to make sure that if they press the Enter key, I want to capture this action and fire the Update command so I can record the actions that I have in the backend and close the inline or form mode input screen.

I'm assuming that I need to add javascript to capture the keypress event and look for the Enter key. The Update and Cancel options must be some form of object I can refocus on, also via javascript? Then how do I fire my backend code to complete this action and close the form?

Do you have any examples that exist or could be shared?  I'd think this is a pretty common request, but didn't find any examples on this site or in the examples installed.

Thanks!

11 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 16 Mar 2009, 05:44 PM
Hi,

I have attached a sample page which demonstrates a basic implementation of the requested functionality.

Please give it a try and let us know if this helps.

Kind regards,
Rosen
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tapjoy
Top achievements
Rank 1
answered on 11 May 2009, 04:25 AM
This works for update operations, but not for insert. How can I make this work for insert using edit forms. Also it does not fire my validator controls in the edit form (template columns).
0
Nikolay Rusev
Telerik team
answered on 13 May 2009, 03:21 PM
Hello Lee,

For your convenience I am attaching sample code of how you can implemented similar functionality for inserting items.
Please find the attached application and review the code.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tapjoy
Top achievements
Rank 1
answered on 18 May 2009, 06:40 AM
Thank you very much Nikolay, but this code does not fire my validator controls on insert or update. Is there a way I can use my existing validation controls on keyboard input as well. The validation works fine when the insert or update buttons are clicked. So maybe there is a way to simulate that click in javascript when the enter key is pressed
0
Nikolay Rusev
Telerik team
answered on 21 May 2009, 05:59 AM
Hello Lee,

Generally all the commands triggered by RadGrid that cause postback will trigger the validators on form.
Can you show us how you have your validators set up?

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kruti Shah
Top achievements
Rank 1
answered on 17 Feb 2010, 06:26 AM
Hello,
In Edit mode when i press Enter key , the edit control will pass to the first record of the RADGRID ...
What should i do to prohibit this?????
0
Nikolay Rusev
Telerik team
answered on 18 Feb 2010, 02:51 PM
Hello Kruti,

Can you please explain a bit more what is the behavior that you are experience?
Can this be replicate on the last application attached to this thread.

Regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shravan
Top achievements
Rank 1
answered on 03 Feb 2012, 06:35 PM
Hi,
I am also getting this issue, In RadGrid Edit mode, if I enter something in a textbox and hit Enter, it will go on Edit mode of first row and open the first row in edit mode with all data lost
0
Shinu
Top achievements
Rank 2
answered on 06 Feb 2012, 05:59 AM
Hello Shravan,

Make sure that you are using advanced data binding methods to bind the grid. Please elaborate your scenario if it doesn't help.

-Shinu.
0
Shravan
Top achievements
Rank 1
answered on 10 Feb 2012, 10:26 PM
Hi Shinu, Sorry for coming back so late, I am autobinding the radgrid with a entitydatasource and doing insert update operation in add/edit mode. if I am editing any row and hitting enter, it is opening the first row in edit mode. please suggest me on this, I am not using the NeedSource.
0
Tsvetina
Telerik team
answered on 15 Feb 2012, 09:19 AM
Hi Shravan,

This is probably related to the Default button feature of your form. You can read more on this, along with a workaround here:
http://marekblotny.blogspot.com/2009/03/defaultbutton-deal-with-users-hitting.html

Regards,
Tsvetina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
MikeK
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Tapjoy
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Kruti Shah
Top achievements
Rank 1
Shravan
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Tsvetina
Telerik team
Share this question
or