I'm trying to create a data-based FAQ in MVC4 using EntityFramework and Bootstrap.
The following code works with 2 problems:
<div class="accordion" id="accordion2">
@foreach (var item in Model.Faqs)
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">@Html.DisplayFor(modelItem => item.Question)
<div id="collapseOne" class="accordion-body collapse ">
@Html.DisplayFor(modelItem => item.Answer)
The problems are:
1. The same answer opens for all questions. I am not sure how to dynamically refer to each question's answer;
2. The answer comes from a sql server field of raw Html. When I try to use Html.Raw instead of Html.DisplayFor, I get the error that "Cannot resolve the method 'Raw(lamda expression)
Any help in completing this greatly appreciated.