Я создаю приложение mvc5 и хочу создать шаблон анкеты, который имеет более одного раздела.У меня проблемы с отображением вопросов из базы данных, и у каждого вопроса есть четыре выпадающих списка с предварительно определенными элементами списка и полем для комментариев.в конце концов, я хочу создать шаблон для анкеты, используя бритвенные страницы.любая помощь будет оценена до сих пор, я пробовал так много вещей, но у меня ничего не получалось, что я пробовал до сих пор:
<table>
<tr>
<th>
Attribute
</th>
<th>
Quality Rate
</th>
<th>
Availability
</th>
<th>
Condition
</th>
<th>
Evaluation
</th>
<th>
Comment
</th>
</tr>
@{
List<InspectionEvaluation> evaluationList = new List<InspectionEvaluation>();
using (adnocDBEntities entities = new adnocDBEntities())
{
var entranceQuestion = from q in entities.QUESTIONS
from l in entities.locations
where l.location_description == "Entrance"
select new
{
q.Question_ID,
q.Question_description,
l.location_id
};
foreach (var obj in entranceQuestion)
{
InspectionEvaluation instance = new InspectionEvaluation();
instance.location_id = obj.location_id;
instance.question_id = obj.Question_ID;
<tr>
<td>
@Html.DisplayFor(obj.Question_description, new { @class = "form-control" })
</td>
<td class="form-group">
@Html.DropDownListFor(instance.QualityRate, new List<SelectListItem>
{
new SelectListItem { Text = "Male", Value="Male" },
new SelectListItem { Text = "Female", Value="Female" }
}, "Select Quality Rate",new {@class="form-control dropdown-menu" })
</td>
<td>
@Html.DropDownListFor(instance.Avaliability, new List<SelectListItem>
{
new SelectListItem { Text = "Yes", Value="Yes" },
new SelectListItem { Text = "No", Value="No" }
}, "Select Availability",new {@class="form-control dropdown-menu" })
</td>
<td>
@Html.DropDownListFor(instance.Condition, new List<SelectListItem>
{
new SelectListItem { Text = "New", Value="New" },
new SelectListItem { Text = "Old", Value="Old" }
}, "Select Condition",new {@class="form-control dropdown-menu" })
</td>
<td>
@Html.DropDownListFor(instance.Evaluation, new List<SelectListItem>
{
new SelectListItem { Text = "Replace", Value="Replace" },
new SelectListItem { Text = "Required", Value="Required" },
new SelectListItem { Text = "Recommend", Value="Recommend" }
}, "Select Evaluation",new {@class="form-control dropdown-menu" })
</td>
<td>
@Html.TextBoxFor(instance.Comment, new { @class = "form-control", @Style = "border-radius:20px;" })
</td>
</tr>
evaluationList.Add(instance);
}
}
}
</table>
</div>
</div>