How can I capture data in my text box and use it in my model?
I am in the Create () view and I want to access the model to put the contents
<textarea>
into one of the model properties, the Content property in this case.
namespace TestTinyMCE.Models { public class TestBlog { public int TestBlogId { get; set; } public string Title { get; set; } public DateTime PostedOn { get; set; } public string Tags { get; set; } public string Content { get; set; } } }
I cannot use TextAreaFor since I accept HTML markup (bold, italics, etc.). I use TinyMCE in my text box, if that matters.
I tried to hook the send event through the jQuery.submit API:
<script type="text/javascript"> $(document).ready(function () { tinyMCE.init({ theme: "advanced", mode: "textareas" }); $('#contentEditor').submit(function () { alert('Handler for .submit() called.'); return false; }); }); </script>
but while .submit () occurred in $ (document) .ready, the handler itself never fires.
and here is my text box:
<div class="editor-field"> <textarea id="contentEditor" name="contentEditor"></textarea> </div>
jquery asp.net-mvc
John WS Marvin
source share