Can't seem to find an answer that works on the forums anywhere for this one.
When I press enter when in edit mode on a text cell, I want to insert a new line rather than ending the cell edit, but no combination of catching key presses or any other grid or cell events seems to be able to achieve this.
Any help with this would be greatly appreciated.
Shane
8 Answers, 1 is accepted
Thank you for your question. The AcceptsReturn property of GridViewTextBoxColumn defines how the editor handles Enter key - end edit ('false', default value) or create new line.
If you have further questions, we will be glad to help.
Best regards,
Alexander
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Shane

Can you please tell how to edit this??
I tried including the following code, so that a new row is created when you press enter WHILE YOU'RE EDITING one particular cell.
$(document).on('keypress','#grid',function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
grid.addRow();
}
});
Thank you for writing.
Note that this forum is related to the UI for WinForms product. However, your question seems to be related to Kendo UI. I would kindly ask you to post your question in the appropriate forum: http://www.telerik.com/forums/kendo-ui.
Thank you for your understanding.
Regards,
Dess
Telerik

Thank you for writing.
Indeed, it is necessary to enable the multiline text for the editor as well:
public
Form1()
{
InitializeComponent();
foreach
(GridViewColumn col
in
this
.radGridView1.Columns)
{
GridViewTextBoxColumn tbCol = col
as
GridViewTextBoxColumn;
if
(tbCol !=
null
)
{
tbCol.AcceptsReturn =
true
;
}
}
}
private
void
radGridView1_CellEditorInitialized(
object
sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
RadTextBoxEditor tbEditor = e.ActiveEditor
as
RadTextBoxEditor;
if
(tbEditor !=
null
)
{
RadTextBoxEditorElement element = tbEditor.EditorElement
as
RadTextBoxEditorElement;
element.TextBoxItem.Multiline =
true
;
}
}
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik

Hi,
I'm still having trouble with this despite setting the Multiline and AcceptsReturn properties of my text columns to true. When pressing Enter in a new row, EndEdit is called and the new row is added. Only when I edit an existing row can I insert carriage returns.
Thank you for writing.
Pressing Enter key on the new row will commit the row data by default. However, when multiline is enabled and the GridViewTextBoxColumn.AcceptsReturn property is set to true, you can enter multiline text in the new row. Please refer to the attached sample project which result is illustrated in the attached gif file with the latest version.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Progress Telerik