views:

37

answers:

0

I have added ckeditor on my page. the thing is that when i make changes in the value in the ckeditor and post the value to the controller the new posted value is not there (the previous value is coming). the new value comes on posting it second time.the cycle goes on(the changes in the value in the ckeditor comes on the second posting). if i remove the createsuccess call and use html.beginform it work fine(but i have to return the value from the controller). what i am doing wrong

<script type="text/javascript" >


       function createSuccess(context)
    {
         alert(context.get_data());
    }


$(function(e) {  $('#editor1').ckeditor();

  });

</script>

<% using (Ajax.BeginForm("Index" , new AjaxOptions {OnSuccess="createSuccess"})) { %>
<textarea cols="20" rows="20" id="editor1" name="editor1">Abcdedfghijklmnopqrst</textarea>
<input type="submit"  />
<% }  %>

Controller

 public ActionResult Index(FormCollection frm)

    {
        string a = frm["editor1"];

        var data = new { PreviousValues = a };
        return Json(data);
    }