Saving Kendo Editor text to database

2 posts, 0 answers
  1. Romik
    Romik avatar
    4 posts
    Member since:
    Feb 2016

    Posted 05 May 2017 Link to this post

    I have a Kendo Editor which is defined as below:

    @(Html.Kendo().Editor()
                        .Name("myEditor")
                        .Tag("div")
                        .Tools(tools => tools
                                .Clear()
                                .Bold()
                                .Italic()
                                .Underline()
                                .Strikethrough()
                                .JustifyCenter().JustifyFull().JustifyLeft().JustifyRight()
                                .CreateLink().Unlink().TableEditing().FontColor().BackColor())
                         .Value(@<text>
                                    Hello Kendo Editor <some text with html tags here>
                            </text>)
                    )

    Then I have two buttons that show up only for the admins - Save and Edit, and they are defined as below -

    <button type="button" id="btnedit">Edit</button>
     <input type="submit" name="btnSave"  id="btnSave" value="Save" class="btn btn-default" />

     

    There are other two submit buttons on the form like below -

    <input type="submit" name="btnAgree"  id="btnAgree"  value="Agree" class="btn btn-primary" />
    <input type="submit" name="btnDisagree" id="btnDisagree" value="Disagree" class="btn btn-default" />

     

    And the form handles the submit of Agree and Disagree buttons by using the BeginForm("ActionMethod", "Controller", FormMethod.Post) like below -

    @using (Html.BeginForm("Index", "MyControllerName", FormMethod.Post))

     

    Now I want that, when an admin user comes in and makes changes to the Editor text and hits 'Save' button, I want the text of the editor to get saved in database. I can handle the saving part. I just want to know, how can I get the text from the Kendo Editor and send the text value to the action method in the controller.  

    I tried the solution provided in this thread here - http://www.telerik.com/forums/save-changes-to-and-print-content-of-editor-in-mvc

    So, using the solution here I added an action method with the string argument name similar to the Editor name like below -

    public ActionResult Save(string myEditor) {

    // TO DO: Save the text to the database

     }

    When I run my application, and hit 'Save' button, I get the below error - 

    HTTP Error 404.0 - Invalid navigation
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    It does not hit the 'Save' Action method. How can I get that working?

    Thanks

  2. Nikolay
    Admin
    Nikolay avatar
    84 posts

    Posted 09 May 2017 Link to this post

    Hi,

    Please review this help article: http://docs.telerik.com/kendo-ui/controls/editors/editor/troubleshoot/troubleshooting#inline-value-is-not-posted-to-server. The editor renders a DIV element in this case which is not a form element and is not posted to the server.

    @(Html.Kendo().Editor()
                        .Name("myEditor")
                        .Tag("div")

    Regards,
    Nikolay
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top