vendredi 10 avril 2015

Summernote and form submission in MVC c#

I am using the summernote plugin for text box: http://ift.tt/1HUZ1FG


This is the form I have using summmernote:



<div class="modal-body" style="max-height: 600px">
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset class="form-horizontal">
<div id="textForLabelLanguage"></div>
<button type="submit" class="btn btn-primary">Save changes</button>
@Html.ActionLink("Cancel", "Index", null, new { @class = "btn " })
</fieldset>
}
</div>

<script type="text/javascript">
$(document).ready(function () {
$('#textForLabelLanguage').summernote();
});
</script>


Now, In my controller, this is the code I have:



public ActionResult Create(UserInfo newInfo , [Bind(Prefix = "textForLabelLanguage")] string textForLabelLanguage)
{
//logic here
}


Now the problem is that textForLabelLanguage param is always null.


This happens because I have to pass $('#textForLabelLanguage').code(); into MVC when submiting the form but I have no idea how to do that!


How do I solve my problem?


Aucun commentaire:

Enregistrer un commentaire