By design, the auto-size rows functionality that RadGridView
offers, takes into consideration the cell's value when calculating the required height for the row. However, note that while the editor is active and you enter any text, the value is changed only in the active editor. It is not committed to the cell yet. That is why the row's height is not adjusted until you press Enter to commit the editor's value to the cell.
You can handle the RadGridView.ValueChanged
event which is fired when the editor's value is changed and update the associated cell. The following code snippet demonstrates how to achieve the illustrated result in the attached gif file:
private void radGridView1_ValueChanged(object sender, EventArgs e)
if (this.radGridView1.CurrentRow is GridViewDataRowInfo)
this.radGridView1.CurrentCell.Value = this.radGridView1.ActiveEditor.Value;
As to the question about pressing Control+Enter to insert a new line in the RadTextBoxEditor, note that it hosts internally the standard MS TextBox from where this behavior comes. You can enable the AcceptsReturn property of the hosted text box in order to allow entering new lines only by pressing Enter. However, in this case, pressing Enter won't commit the editor's value to the cell and ends the edit operation. It would be necessary to press the pencil indicator at the beginning of the row to commit the new value:
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
editor.Multiline = true;
RadTextBoxEditorElement element = editor.EditorElement as RadTextBoxEditorElement;
element.TextBoxItem.AcceptsReturn = true;
Should you have further questions please let me know.
Dess | Tech Support Engineer, Sr.
Get quickly onboarded and successful
with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.