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

newline - data not saved

2 Answers 46 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Terje
Top achievements
Rank 1
Terje asked on 29 May 2013, 11:23 AM
Anybody experienced this using Kendo UI Editor?

When typing a lot of text without a newline (Enter-button) everything saves just fine, but if anybody press the enterbutton to make the text more readable, the data just does not get saved. Being newbie on both mvc and kendo, I really need help getting past this problem..

Using OpenAccess ORM.

Thanks in advance.
public partial class Exercises
{
private string _note;
public virtual string Note
{
get { return this._note; }
set { this._note = value; }
}
}
Exercise.Note = drill.Comments;
DB.SaveChanges();
<div class="editor-label">
    @Html.LabelFor(m=>m.Comments)
</div>
<div class="editor-field">
    @Html.EditorFor(m=>m.Comments)
    @Html.ValidationMessageFor(m=>m.Comments)
</div>
[Display(Name = "Comments", ResourceType = typeof(DisplayNameStrings)), UIHint("Editor")]
        public string Comments { get; set; }

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 31 May 2013, 08:03 AM
Hello,

The problem could be caused by an exception thrown on the server for dangerous request. When pressing enter, HTML tags will be added to the value and MVC will thrown an exception if the editor encoding is disabled. If that is the case, then you could use the AllowHtml attribute on the model property to specify that HTML is allow for the field:

[Display(Name = "Comments", ResourceType = typeof(DisplayNameStrings)), UIHint("Editor"), AllowHtml]
public string Comments { get; set; }
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Terje
Top achievements
Rank 1
answered on 10 Jul 2013, 06:55 AM
That did the trick.

Thank you.
Tags
Editor
Asked by
Terje
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Terje
Top achievements
Rank 1
Share this question
or