Hello,
In my mobile application there is an Editor who value i want to submit on save button click. But when i post form serialize the Controller gets no value for Editor in formcollection
@(Html.Kendo().MobileView()
.Name("Notizen")
.Stretch(true)
.Layout("mobile-tabstrip")
.Title("Notizen")
.Content(@<text>
<form class="frmAdressNotes" action="@Url.Action("SubmitMobileNotes", "AdressDetail")" id="frmAdressNotes" method="post">
@(Html.Kendo().Editor().Value(Model.Notes)
.HtmlAttributes(new { style = "width: 480px;height:350px"})
.Name("editor").Encode(true)
)
</form>
</text>)
)
@Html.Hidden("txtTheme1", Session["theme"].ToString())
@(Html.Kendo().MobileLayout()
.Name("mobile-tabstrip")
.Header(obj => NavBarTemplate(this))
)
@helper NavBarTemplate(WebViewPage page)
{
@(Html.Kendo().MobileNavBar()
.Content(navbar =>
@<text>
@(Html.Kendo().MobileButton()
.Align(MobileButtonAlign.Right)
.HtmlAttributes(new { @class = "save"})
.Events(events => events.Click("onClick"))
.Text(""))
</text>)
)
}
function onClick(e) {
var $form = $("#frmAdressNotes");
$form.find("[data-role=editor]").each(function () {
var editor = $(this).data("kendoEditor");
// ... append a hidden input that holds the editor value
$("<input type='hidden' />")
.attr("name", editor.element.attr("id"))
.val(editor.value())
.appendTo(form);
});
var dataPost = $form.serialize();
$.ajax({
url: "@Url.Action("SubmitMobileNotes", "AdressDetail")",
type: 'POST',
strNotes: dataPost,
cache: false,
aysnc:false,
success: function (data) {
if (data == "Error") {
alert(data);
} else {
window.location.href = data;
}
}
});
}
if i write the code in form submit Event it Posts correctly. But i Need a Ajax call .Here is my Controller method
public void SubmitMobileNotes(ControlsContext notemodel, FormCollection formCollection)
{
string keyvalue = formCollection["editor"];
keyvalue is always null
Thanks
Anamika