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

Enter key behavior in RadGrid GridTemplateColumn

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boyan
Top achievements
Rank 1
Boyan asked on 27 Mar 2012, 06:41 PM
Hello:

I am experiencing the following problem (I am using ASP.NET AJAX Q3 2010 NET40): I have a grid that uses template columns. When a row is in edit mode and I press the enter key in the textbox after editing the item, a new item is inserted. I wonder why this happens in the first place and what I can do to disable/avoid this behavior.

I have tried disabling automatic inserts, keyboard navigation, submit on enter but to no avail.

 Any feedback is appreciated. 
Thanks!

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 29 Mar 2012, 04:04 PM
Hello Boyan,

In order to disable the enter key you have to specify a function that will be called client-side when a key is pressed and to cancel it on the corresponding javascript.

This aproach is throughly explained in this article.

I hope this helps.

Regards,
Eyup
the Telerik team

If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Boyan
Top achievements
Rank 1
answered on 29 Mar 2012, 10:10 PM
Hello Eyup,

I tried following the example in the article and ran it in debug mode. The javascript function got executed but, unfortunately, it still added a new item in the beginning of the grid as if an insert command had been triggered.

But I found out what was happening with the grid. Since key navigation was disabled, upon pressing the Enter key, a button that I have in the CommandItemTemplate was being "clicked" so it was firing the command it's wired to. Enabling keyboard navigation and allowing submit on enter fixed the issue for me.
0
Eyup
Telerik team
answered on 03 Apr 2012, 07:07 PM
Hi Boyan,

I'm glad you resolved the issue. Good luck with your project.

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Boyan
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Boyan
Top achievements
Rank 1
Share this question
or