I have a following view model and it will be used to get Issue Description and Steps to recreate issue.
public class IssueViewModel
{
public string IssueDesc { get; set; }
public string ReCreationSteps { get; set; }
}
View
@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" />
}
Controller
[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);
}
I would like to give an user a simple control to enter issue recreation steps.So I end up with the contenteditable attribute set to true for div element.
I have binded ReCreationSteps to Div element,but its not working.I can't get the value/html of DIV in ReCreationSteps property once the form is submitted.
Anyone help me on this or suggest me some other solution.