我建立了一个允许客户填写调查问卷的系统。为了完成调查问卷,用户必须输入他们的唯一编号,该编号使用存储过程从不同的数据库中提取数据。
无论如何,我想要做的是当客户完成他们的调查问卷并点击创建id,如要突出显示的单元格/字段集,以便我知道哪个客户已完成调查问卷。
仍在改进我的前端开发,但可以提供一些帮助。我只发布了我的前端(视图)代码,因为这是需要完成工作的地方。
任何人都可以使用javascript / Jquery
指导我<fieldset style="width:1200px;">
<legend>StoreQuestions</legend>
@Html.HiddenFor(model => model.storeId)
<div class="editor-label">
<h3>What condition was your Item in when you received it? (1 - Very Poor, 2 - Standard, 3 - Good , 4 - Excellent)</h3>
</div>
<input type="submit" value="Create" class="button">
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(StoreQuestions storequestions)
{
if (ModelState.IsValid)
{
db.StoreQuestions.Add(storequestions);
db.SaveChanges();
return RedirectToAction("Details", "Questions", new { id = storequestions.QuestionsId });
}
return View(storequestions);
}
答案 0 :(得分:0)
从未测试过代码,但是:
<fieldset style="width:1200px;">
<legend>StoreQuestions</legend>
@Html.HiddenFor(model => model.storeId)
<div class="editor-label" style='background-color:@(Model.id == theIdOfTheQuestion ? "blue" : "")'>
<h3>What condition was your Item in when you received it? (1 - Very Poor, 2 - Standard, 3 - Good , 4 - Excellent)</h3>
</div>
<input type="submit" value="Create" class="button">
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(StoreQuestions storequestions)
{
if (ModelState.IsValid)
{
db.StoreQuestions.Add(storequestions);
db.SaveChanges();
return RedirectToAction("Details", "Questions", new { id = storequestions.QuestionsId });
}
return View(storequestions);
}
您可以使用<div class="editor-label"..
包裹@foreach
来生成问题,然后从中获得theIdOfTheQuestion