zakaria mouqcit
zakaria mouqcit

Reputation: 393

Allow textarea having html value

I'm working on a ASP.net MVC5 application and I want to send html code to the DB via Text area but this one doesn't seem to be allowing it. Here is a piece of code of what I'm trying to do :

    <div class="col-md-5">
            @Html.TextAreaFor(model => model.PRETEXT, new { htmlAttributes = new { @class = "form-control" }, cols = 50, rows = 10 })
            @Html.ValidationMessageFor(model => model.PRETEXT, "", new { @class = "text-danger" })
        </div>
    </div>

I'm wondering if is there any possibility to make it accept html tags.

Upvotes: 0

Views: 176

Answers (1)

dom
dom

Reputation: 6832

You need to decorate your PRETEXT property with the AllowHtml attribute :

[AllowHtml]
public string PRETEXT { get; set; }

Upvotes: 1

Related Questions