次のビューモデルがあり、問題の説明と問題を再現する手順を取得するために使用されます。
public class IssueViewModel
{
public string IssueDesc { get; set; }
public string ReCreationSteps { get; set; }
}
意見
@using (Html.BeginForm())
{
@Html.LabelFor(model => model.IssueDescription)
@Html.TextAreaFor(m=>m.IssueDescription)
@Html.LabelFor(model => model.ReCreationSteps )
<div class="editable" id="ReCreationSteps " name="ReCreationSteps" contenteditable="true">
<ol>
<li></li>
</ol>
</div>
<input value="Create" type="submit" />
}
コントローラ
[HttpPost]
public ActionResult Create(IssueViewModel model)
{
string html = model.Recreation;
//<ol><li>Step:1 Enter the text</li><li>Step:2 Click the button <li></ol>
Issue newIssue = model.ToIssue(); // here value will be splitted and add steps to table
_issueRepository.AddIssue(Issue);
}
問題の再現手順を入力するための簡単なコントロールをユーザーに提供したいと思います。そのため、div 要素の contenteditable 属性を true に設定することになります。
ReCreationSteps を Div 要素にバインドしましたが、機能しません。フォームが送信されると、ReCreationSteps プロパティで DIV の値/html を取得できません。
誰でもこれについて私を助けてくれるか、他の解決策を提案してください。