本文介绍了如何计算用户给出的正确答案的数量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net中使用c#编码创建了一个页面。该页面用于测试。测试包含10个问题,每个问题有4个选项。我为每个选项使用了单独的单选按钮,这对于一个问题的答案我有4个无线电单选按钮。所以现在我有40个单选按钮。现在我想获得用户在点击提交按钮时尝试的正确答案的结果。请有人帮助我。

i没有使用任何数据库......问题写在.aspx页面上,4个单选按钮用于提供4个选项。

i have created a page in asp.net with c# coding . That page is for taking a test . Test contains 10 questions and every question has 4 options . i used separate radio buttons for every options it means for one question's answer i have 4 radio radio buttons. so now i have total 40 radio buttons . Now i want to get the result of the correct answers attempted by the user on the click of submit button . Please someone help me in this .
i didn't use any database....the questions are written on .aspx page and the 4 radio buttons are taken for giving 4 options.

推荐答案

SELECT SUM(Answers) FROM MyTable WHERE UserId=666

将为用户666做。



如果这不是你存储的方式,那么那里是你可以做的大量事情 - 我们无法分辨它们是什么!

Will do it for user 666.

If that isn't how you store things, then there is a huge range of things you could be doing - and we can't tell what they are!


RadioButton [] rbGood =
 { RadioButton2, RadioButton6, RadioButton10, RadioButton14, RadioButton18,
   RadioButton22, RadioButton26, RadioButton30, RadioButton34, RadioButton38 };
int total = 0;
for (int k=0; k<9; k++)
{
  if (rbGood[k].Checked) total++;
}
Label1.Visible = true;
Label1.Text = total.ToString();


这篇关于如何计算用户给出的正确答案的数量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 16:23