0
下面是我用來輸入多行文章的視圖 我希望你也可以告訴我如何保存文本屬性,如粗體斜體,因爲它使我很困惑。如何在asp中使用多行保存textarea中的文本mvc
@model WEBSITI.Models.article
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm("Create", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="form-group">
@Html.LabelFor(model => model.bodyofarticle, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.bodyofarticle, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.bodyofarticle, "", new { @class = "text-danger" })
</div>
<input type="file" id="file" name="file" />
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
先生這樣我就可以用替換法來改變\ n,其中<\br>當我添加新的文章??? –
爲什麼要替換?如果您支持HTML類型的內容,則應考慮使用富文本編輯器。 – Shyju
我不知道,但我替換它來更改插入,因爲用戶將按輸入,而不是打印「
」,但是當我顯示的數據它打印
而不是打印換行 –