Link to home
Start Free TrialLog in
Avatar of sunny-j
sunny-j

asked on

MVC html markup editor

Is there a way in ASP.NET MVC (c#) to create html markup and save to database and then of course to be able to edit it in a html editor in a view.

Here is the issue.

This control below will only take in text at the moment but i need to add in formatted text. Do i need to add in an editor or is there anything within visual studio/c# mvc that will enable me to add formatted text. If not, please recommend the best html editor for this purpose. Thanks in advance.

    <div class="form-group">
                @Html.LabelFor(model => model.FullDescription, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @*@Html.TextAreaFor(model => model.FullDescription, new { htmlAttributes = new { @class = "form-control" } })*@
                    @Html.TextAreaFor(model => model.FullDescription, 10,40, htmlAttributes: new {style="width: 100%; max-width: 100%;" })
                    @Html.ValidationMessageFor(model => model.FullDescription, "", new { @class = "text-danger" })
                </div>
            </div>
Avatar of Dustin Saunders
Dustin Saunders
Flag of United States of America image

I think I understand what you're asking, have you condsidered using MvcHtmlString as your class for the text?

https://msdn.microsoft.com/en-us/library/system.web.mvc.mvchtmlstring(v=vs.118).aspx
Avatar of sunny-j
sunny-j

ASKER

Thank you for taking the time to reply. This is useful but in the end I used something called TinyMCE -  https://www.tiny.cloud/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.