首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在用户单击按钮时突出显示已归档的单元格

如何在用户单击按钮时突出显示已归档的单元格
EN

Stack Overflow用户
提问于 2016-11-10 19:11:24
回答 1查看 36关注 0票数 0

我已经建立了一个系统,允许客户完成调查问卷。为了完成调查问卷,用户必须输入他们的唯一编号,该编号使用存储过程从不同的数据库中提取数据。

无论如何,我尝试做的是当客户完成他们的调查问卷并单击create id,就像要突出显示的单元格/字段集一样,这样我就可以知道哪个客户已经完成了调查问卷。

仍在改进我的前端开发,但需要一点帮助。我只发布了我的前端(视图)代码,因为那是需要完成工作的地方。

有人能用javascript/Jquery来指导我吗

代码语言:javascript
运行
复制
<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);
}
EN

回答 1

Stack Overflow用户

发布于 2016-11-10 19:24:04

从来没有测试过代码,但是:

代码语言:javascript
运行
复制
<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);
    }

您可以使用@foreach包装<div class="editor-label"..以生成问题,并从中获得theIdOfTheQuestion

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40526160

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档