I have a simple grid with one text column in multiline mode. When I go into edit mode I can enter newlines by using Alt-Enter. But when I leave the edit mode my input shows in one line. How can I have my input also in multiple lines?
Here is my code:
var model = getGridModel(parentID, strTypeItem); model.AutoCommit = false; model.Columns.Add(new GridColumn { Key = "Value", DataType = "string", HeaderText = "Comment", Width = "50%" }); model.Columns.Add(new GridColumn { Key = "User", DataType = "string", Width = "25%" }); model.Columns.Add(new GridColumn { Key = "DateCreate", DataType = "date", Format = "yyyy-MM-dd", HeaderText = "Date", Width = "25%" }); var updating = new GridUpdating(); updating.EnableAddRow = true; updating.EnableDeleteRow = true; updating.EditMode = GridEditMode.Row; updating.ColumnSettings.Add( new ColumnUpdatingSetting { ColumnKey = "DateCreate", EditorType = ColumnEditorType.DatePicker, ReadOnly = true }); updating.ColumnSettings.Add( new ColumnUpdatingSetting { ColumnKey = "User", DefaultValue = user.Identity.GetUserName(), ReadOnly = true }); var cus = new ColumnUpdatingSetting { ColumnKey = "Value", Required = true }; cus.TextEditorOptions.TextMode = TextEditorTextMode.Multiline; cus.TextEditorOptions.Height = "200px"; cus.TextEditorOptions.PreventSubmitOnEnter = true; updating.ColumnSettings.Add(cus); model.Features.Add(updating);
Hello Petra,
I assume that if you didn't set a width to that column, it will expand until the entered text width. Please try to set a width and let me know if the behavior changes.
Regards,
Tsanna
Hallo Tsanna,
Sorry you cannot see the whole code.
I did set a width. For my 3 columns I set the widths 50%, 25% and 25%. I also tried a pixel width. It doesn't make a difference.
If I am in edit mode, my newlines are showing, if I leave edit mode, all is showing in one line.
Please help,
Petra.
Here my code again:
var model = getGridModel(parentID, strTypeItem); model.AutoCommit = false; model.Columns.Add(new GridColumn { Key = "Value", DataType = "string", HeaderText = "Comment", Width = "50%" }); model.Columns.Add(new GridColumn { Key = "User", DataType = "string", Width = "25%" }); model.Columns.Add(new GridColumn { Key = "DateCreate", DataType = "date", Format = "yyyy-MM-dd", HeaderText = "Date", Width = "25%" });
var updating = new GridUpdating(); updating.EnableAddRow = true; updating.EnableDeleteRow = true; updating.EditMode = GridEditMode.Row; updating.ColumnSettings.Add( new ColumnUpdatingSetting { ColumnKey = "DateCreate", EditorType = ColumnEditorType.DatePicker, ReadOnly = true }); updating.ColumnSettings.Add( new ColumnUpdatingSetting { ColumnKey = "User", DefaultValue = user.Identity.GetUserName(), ReadOnly = true });
var cus = new ColumnUpdatingSetting { ColumnKey = "Value", Required = true }; cus.TextEditorOptions.TextMode = TextEditorTextMode.Multiline; cus.TextEditorOptions.Height = "200px"; cus.TextEditorOptions.PreventSubmitOnEnter = true; // not working updating.ColumnSettings.Add(cus); model.Features.Add(updating); model.UpdateUrl = "/PCNAnalysis/CacheDataItems?type=" + strTypeItem;
Along with the column's width you should set also width to the whole grid. Did you do that? If you did it and the text is still visible on a single line, then please send me a sample, so that I can test it on my side.
Petra,
Your problem progressively changes. Please identify your problem, because you confuse me. On my side Alt+Enter works fine. Attached is a sample for your reference.
If I can be of further assistance for you, let me know.
Regards,Tsanna
Hi Tsanna,
the grid's width was set to "100%", when I had the problem. Changing it to a fixed width e.g. "750px" is not changing anything.
But I have to precise the problem: the text is showing in multiple line but the Alt-Enters are ignored. The text wraps when column end is reached.