EditorFor binding not working on form submit

2 posts, 0 answers
  1. Karl
    Karl avatar
    9 posts
    Member since:
    Oct 2012

    Posted 21 Aug 2015 Link to this post

    The control manages to bind and show the value from my model, but when I submit the form, the model in my controller does not show the updated value from the editor.


    I have tried using a normal @Html.EditorFor() and this works as expected. (ie I see the updated value)


     @model GeneralDisclosureEntity

    @using (Html.BeginForm("GeneralDisclosureTextUpdate", "DataManagement", FormMethod.Post, new { enctype = "multipart/form-data" }))

        <div hidden="hidden">
        @(Html.Kendo().EditorFor(m => m.HTML)
              .HtmlAttributes(new { style = "width:100%;height:440px" })
              .Tools(t => t.Clear()

        <br />

      <button id="btnSubmit3" type="submit" style="float:right")>Save Text</button>

  2. Alexander Popov
    Alexander Popov avatar
    1434 posts

    Posted 25 Aug 2015 Link to this post

    Hello Karl,

    I've noticed that the name of the widget is explicitly specified as "Content". This might cause issues with the model binding on the server-side, as the Controller method probably expects a field named "HTML". Generally speaking, all For helpers (e.g EditorFor, ComboBoxFor and etc) automatically assign a name to the widget, so manually doing that is not necessary. Removing the Name method from the widget's configuration should solve the issue.

    Alexander Popov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top