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

Need help with editor

1 Answer 61 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Svetoslav
Top achievements
Rank 1
Svetoslav asked on 13 Feb 2013, 01:14 PM
I want to take the value from the editor and pass it to the model to be added into the data base but i dont know how to implement the part with the value go from the editor to the model here is the place im so far

CSHTML
@using ( Html.BeginForm("Admin", "Account") )
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend><b>Създаване на нова новина</b></legend>
        <h1>Title</h1>
        @*Render the editor for the title*@
        @(Html.Kendo().EditorFor(m => m.title).Name("Title").Value("Заглавието на новината"))
        <h1>NewsText</h1>
        @*Render the editor for the text*@
        @(Html.Kendo().EditorFor(m => m.text).Name("Text").Value("Текста на новината"))
        <input type="button" value="Submit" />
    </fieldset>
}
Controller

           [Authorize]
        [HttpGet]
        public ActionResult Admin()
        {
           return View();
        }
 
        [HttpPost]
        public ActionResult Admin(string Title, string Text)
        {
            NewsDal.setNews(Title, Text);
            return Redirect("/Home/News");
        }
Model Method
public static void setNews(string Title, string Text)
        {
            InfoEntities db = new InfoEntities();
            db.AddToNews(new News()
            {
                title = Title,
                text = Text,
            });
            db.SaveChanges();
        }

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Feb 2013, 09:22 AM
Hi Svetoslav,

I tested the current implementation on our side (I just added a submit button to the form to post the data) and everything is working as expected. Could you provide more information what exactly are you trying to achieve?
 

Greetings,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Svetoslav
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or