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

Saving Kendo Editor text to database

3 Answers 490 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Romik
Top achievements
Rank 1
Romik asked on 05 May 2017, 07:36 PM

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

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 09 May 2017, 03:24 PM
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.
0
swati
Top achievements
Rank 1
Veteran
answered on 21 Dec 2020, 06:18 PM

Hi I am also on the same boat. I am using Kendo editor for rich text feature, however I am having issues saving into database and retrieving for editing.

The link published by Nikolay is no longer exist. It returns to 404. Will you please let me know?

Swati

0
Ivan Danchev
Telerik team
answered on 23 Dec 2020, 02:58 PM

Hi Swati,

Here's the correct documentation link: https://docs.telerik.com/kendo-ui/controls/editors/editor/troubleshooting#the-inline-value-is-not-posted-to-the-server

Regards,
Ivan Danchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Editor
Asked by
Romik
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
swati
Top achievements
Rank 1
Veteran
Ivan Danchev
Telerik team
Share this question
or