Hello,
I am attempting to use the Editor control as an EditorTemplate for HTML fields in my MVC4 application. The editor will display fine, but for some reason the code will never update and the value always comes back up the Model as null. Any ideas what I am doing wrong?
Here is the code for Html.cshtml:
@model System.String
@Html.AntiForgeryToken()
<textarea id="@Html.DisplayNameFor(c => c)" rows="10" cols="30" style="width:500px;height:250px">@Model</textarea>
<script>
$(document).ready(function () {
$("#@Html.DisplayNameFor(c => c)").kendoEditor();
});
</script>
Thanks!
I am attempting to use the Editor control as an EditorTemplate for HTML fields in my MVC4 application. The editor will display fine, but for some reason the code will never update and the value always comes back up the Model as null. Any ideas what I am doing wrong?
Here is the code for Html.cshtml:
@model System.String
@Html.AntiForgeryToken()
<textarea id="@Html.DisplayNameFor(c => c)" rows="10" cols="30" style="width:500px;height:250px">@Model</textarea>
<script>
$(document).ready(function () {
$("#@Html.DisplayNameFor(c => c)").kendoEditor();
});
</script>
Thanks!
6 Answers, 1 is accepted
0
John
Top achievements
Rank 1
answered on 15 Mar 2012, 12:38 AM
Adding a name attribute/value pair to your textarea element should resolve this behaviour.
0
Andrey
Top achievements
Rank 1
answered on 16 Jun 2012, 01:16 PM
Hi Robert,
I use following code for this purpose:
<div class="editor-field">
@Html.TextAreaFor(m => m.Description, new {style="width:600px;height:200px"})
</div>
<script>
$(document).ready(function () {
$("#Description").kendoEditor();
});
</script>
Works fine.
I use following code for this purpose:
<div class="editor-field">
@Html.TextAreaFor(m => m.Description, new {style="width:600px;height:200px"})
</div>
<script>
$(document).ready(function () {
$("#Description").kendoEditor();
});
</script>
Works fine.
0
Mikael
Top achievements
Rank 1
answered on 18 Jun 2012, 02:22 PM
Hi Andrey,
I have tried your code and it works in IE9 but not in Chrome. In Chrome the Text is always null in the Model.
Any ideas what to change?
I have now:
<script type="text/javascript">
$(document).ready(function () {
$("#Text").kendoEditor({
encoded: false
});
});
</script>
@Html.TextAreaFor(m => m.Text, new {style="width:600px;height:200px"})
I have tried your code and it works in IE9 but not in Chrome. In Chrome the Text is always null in the Model.
Any ideas what to change?
I have now:
<script type="text/javascript">
$(document).ready(function () {
$("#Text").kendoEditor({
encoded: false
});
});
</script>
@Html.TextAreaFor(m => m.Text, new {style="width:600px;height:200px"})
0
Andrey
Top achievements
Rank 1
answered on 18 Jun 2012, 05:49 PM
Hi Mikael,
Unfortunately I can't reproduce the wrong behavior for Chrome. In my projects it works everywhere.
What MVC version do you use?
Unfortunately I can't reproduce the wrong behavior for Chrome. In my projects it works everywhere.
What MVC version do you use?
0
Mikael
Top achievements
Rank 1
answered on 19 Jun 2012, 07:10 AM
Hi,
we use MVC4.
we use MVC4.
0
Mikael
Top achievements
Rank 1
answered on 06 Jul 2012, 09:16 AM
Hi,
issue has been solved, problem was that the form was placed inside a table element. IE fixed this automatically and Chrome did not.
Now everything works fine with Kendo Editor in both IE and Chrome.
issue has been solved, problem was that the form was placed inside a table element. IE fixed this automatically and Chrome did not.
Now everything works fine with Kendo Editor in both IE and Chrome.