您好,我正在做另一个项目电子调查如何显示问题和选项 [英] Hello , I'm doing another project E-survey how to display the questions and options

查看:78
本文介绍了您好,我正在做另一个项目电子调查如何显示问题和选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我在数据库中添加了问题和选项我怎么能用这样的单选按钮加载它们

Ps每个选项都有一个像Excellent = 10,非常好= 7,好= 5的权重:

我应该在控制器中写什么来提问和他们的选择



1。您对我们的服务有何看法:



a。优秀的b。非常好的c。好的



2.您对我们的客户服务有何看法:



a。优秀的b。非常好的c。好的




我的尝试:



hello, i added the questions and options in DB how i can load them like this with radio buttons
P.s Every option has a weight like Excellent = 10 , very good =7 , good = 5 :
what i should write in controller to get the questions and their options

1. what is your opinion in our service :

a. excellent b. very good c. good

2. what is your opinion in our customer service :

a. excellent b. very good c. good


What I have tried:

this is my View : 
<pre><pre><pre lang="HTML">

@using (Html.BeginForm())
{
    for (int i = 0; i < Model.Questions.Count(); i++)
    {
        @Html.TextBoxFor(model => model.Questions[i].QuestionText, new { placeholder = "Text" })
        <table>
            @for (int j = 0; j < Model.Questions[i].Answers.Count(); j++)
            {
                <!-- Answer block -->
                <tr>
                    <td>@Html.RadioButtonFor(model => model.Questions[i].Answers[j].IsCorrect)</td>
                    <td>@Html.TextBoxFor(model => model.Questions[i].Answers[j].AnswerText)</td>
                </tr>
            }
        </table>
        @Html.TextBoxFor(model => model.Questions[i].QuestionComment)
        <!-- Question block END -->
    }
    <input type="submit"/>

推荐答案

请参阅: ASP.NET MVC中的无线电按钮列表 [ ^ ]



这应该可以帮助您开始使用单选按钮和处理答案来构建问题。
See: Radio button list in ASP.NET MVC[^]

That should help you get started how to build questions with radio buttons and handling answers.


这篇关于您好,我正在做另一个项目电子调查如何显示问题和选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆