Reputation: 291
For Create.cshtml View I have
<div class="editor-field">
@Html.EditorFor(model => model.Content )
@Html.ValidationMessageFor(model => model.Content)
</div>
Now, CKEditor works fine for simple textarea> elements and a submit button.For example:
textarea class="ckeditor" id="editor1" rows="10" cols="20">Sample Text</textarea>
<input type="submit" name="submit" value="Submit" />
My question is how to associate it with the model property in a view so instead of simple multiline textbox it will show CKEditor. Thanks in advance!
Upvotes: 0
Views: 2324
Reputation: 11
Ok, is as simple as this:
<div class="editor-field">
@Html.TextAreaFor(model => model.Text, new { @class = "ckeditor", rows = "15", columns = "130" })
@Html.ValidationMessageFor(model => model.Text)
</div>
Upvotes: 1