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

Web Grid with Incell editing and keyboard navigation - not accepting ENTER for new lines on textarea

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gonzalo almada
Top achievements
Rank 1
gonzalo almada asked on 17 Jul 2013, 06:46 PM
Hi,

I have a grid configured on ASP MVC using Razor with a custom editor template, to show a textarea for editing a big text field.

The grid as per client requirements, needs to allow incell edit and keyboard navigation.

The problem I'm having is that having that configuration doesn't allow me to press Enter key for adding new lines on the textarea while editing, instead cause the cell get out of edit mode.

Couldn't find a way to suppress that behavior nor to change it.

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 19 Jul 2013, 10:14 AM
Hi Gonzalo,

 
You can attach "keydown" event handler to the TextArea in which to check if current key is "enter" to stop the event from bubbling:

Example editor template:

@model string
 
@(Html.TextAreaFor(m => m, new { onkeydown = "stop()"}))
 
<script>
    function stop() {
        if (event.keyCode == 13) {
            event.stopPropagation();
        }
    }
</script>
Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
gonzalo almada
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or