Я делаю html-форму, и когда пользователь отправляет форму, загружается страница aspx
для отображения результатов формы.У меня 20 вопросов по 5 радиокнопок в каждом.По какой-то причине, когда я пытаюсь извлечь выбранные переключатели через цикл for, отображается только один ответ.Что я делаю не так?
Я попытался изменить значения в цикле for, но кажется, что он отображается неправильно.
Вот код для aspx.cs
public void DisplayResults(double[] results)
{
try
{
int q = 1;
for (int i = 0; i <= 19; i++)
{
if (i == 0)
{
txtResults.Text = "Course Results";
if (results[i] == 1)
{
txtResults.Text += "Q" + q + ": Strongly Disagree";
}
else if (results[i] == 2)
{
txtResults.Text += "Q" + q + ": Disagree";
}
else if (results[i] == 3)
{
txtResults.Text += "Q" + q + ": Neutral";
}
else if (results[i] == 4)
{
txtResults.Text += "Q" + q + ": Agree";
}
else if (results[i] == 5)
{
txtResults.Text += "Q" + q + ": Strongly Agree ZERO";
}
}
else if (i == 11)
{
txtResults.Text = "Professor Results";
if (results[i] == 1)
{
txtResults.Text += "Q" + q + ": Strongly Disagree";
}
else if (results[i] == 2)
{
txtResults.Text += "Q" + q + ": Disagree";
}
else if (results[i] == 3)
{
txtResults.Text += "Q" + q + ": Neutral";
}
else if (results[i] == 4)
{
txtResults.Text += "Q" + q + ": Agree";
}
else if (results[i] == 5)
{
txtResults.Text += "Q" + q + ": Strongly Agree ELEVEN";
}
}
else
{
if (results[i] == 1)
{
txtResults.Text += "Q" + q + ": Strongly Disagree";
}
else if (results[i] == 2)
{
txtResults.Text += "Q" + q + ": Disagree";
}
else if (results[i] == 3)
{
txtResults.Text += "Q" + q + ": Neutral";
}
else if (results[i] == 4)
{
txtResults.Text += "Q" + q + ": Agree";
}
else if (results[i] == 5)
{
txtResults.Text += "Q" + q + ": Strongly Agree ELSE";
}
}
if (txtResults.Text == "")
{
throw new Exception();
}
}
}
catch (Exception e)
{
Console.Write(e.Message, "Error");
}
}
Вот код для aspx
<fieldset>
<legend>Feedback Results</legend>
<asp:TextBox ID="txtResults" runat="server" TextMode="MultiLine" Width="100%" Height="500px"></asp:TextBox>
</fieldset>
Вот мой HTML-код
<h3>Please answer these questions to the best of your knowledge:</h3>
<fieldset>
<legend>Course Content (Organization, Clarity of Expectations/Directions, Balance/Appropriateness)</legend>
1. The course (or section) presented skills in a helpful sequence
<br />
<input type="radio" name="q1" value="5" />strongly agree
<input type="radio" name="q1" value="4" />agree
<input type="radio" name="q1" value="3" />neutral
<input type="radio" name="q1" value="2" />disagree
<input type="radio" name="q1" value="1" />strongly disagree
<br />
<br />
2. The course (or section) provided an appropriate balance between instruction and practice
<br />
<input type="radio" name="q2" value="5" />strongly agree
<input type="radio" name="q2" value="4" />agree
<input type="radio" name="q2" value="3" />neutral
<input type="radio" name="q2" value="2" />disagree
<input type="radio" name="q2" value="1" />strongly disagree
<br />
<br />
3. The course (or section) was appropriate for the stated level of the class
<br />
<input type="radio" name="q3" value="5" />strongly agree
<input type="radio" name="q3" value="4" />agree
<input type="radio" name="q3" value="3" />neutral
<input type="radio" name="q3" value="2" />disagree
<input type="radio" name="q3" value="1" />strongly disagree
<br />
<br />
4. The course (or section) was organized in a way that helped me learn
<br />
<input type="radio" name="q4" value="5" />strongly agree
<input type="radio" name="q4" value="4" />agree
<input type="radio" name="q4" value="3" />neutral
<input type="radio" name="q4" value="2" />disagree
<input type="radio" name="q4" value="1" />strongly disagree
<br />
<br />
5. The lab helped to complement the lectures
<br />
<input type="radio" name="q5" value="5" />strongly agree
<input type="radio" name="q5" value="4" />agree
<input type="radio" name="q5" value="3" />neutral
<input type="radio" name="q5" value="2" />disagree
<input type="radio" name="q5" value="1" />strongly disagree
<br />
<br />
6. The course (or section) provided a mixture of explanation and practice
<br />
<input type="radio" name="q6" value="5" />strongly agree
<input type="radio" name="q6" value="4" />agree
<input type="radio" name="q6" value="3" />neutral
<input type="radio" name="q6" value="2" />disagree
<input type="radio" name="q6" value="1" />strongly disagree
<br />
<br />
7. The course (or section) was effectively organized
<br />
<input type="radio" name="q7" value="5" />strongly agree
<input type="radio" name="q7" value="4" />agree
<input type="radio" name="q7" value="3" />neutral
<input type="radio" name="q7" value="2" />disagree
<input type="radio" name="q7" value="1" />strongly disagree
<br />
<br />
8. The course (or section) assignments and lectures usefully complemented each other
<br />
<input type="radio" name="q8" value="5" />strongly agree
<input type="radio" name="q8" value="4" />agree
<input type="radio" name="q8" value="3" />neutral
<input type="radio" name="q8" value="2" />disagree
<input type="radio" name="q8" value="1" />strongly disagree
<br />
<br />
9. The course (or section) instructions (including, manuals, handouts, etc.) were clear
<br />
<input type="radio" name="q9" value="5" />strongly agree
<input type="radio" name="q9" value="4" />agree
<input type="radio" name="q9" value="3" />neutral
<input type="radio" name="q9" value="2" />disagree
<input type="radio" name="q9" value="1" />strongly disagree
<br />
<br />
10. The course (or section) work helped me understand concepts more clearly
<br />
<input type="radio" name="q10" value="5" />strongly agree
<input type="radio" name="q10" value="4" />agree
<input type="radio" name="q10" value="3" />neutral
<input type="radio" name="q10" value="2" />disagree
<input type="radio" name="q10" value="1" />strongly disagree
<br />
<br />
11. Instructions for course (or section) materials (including manuals, handouts, etc.) were clear
<br />
<input type="radio" name="q11" value="5" />strongly agree
<input type="radio" name="q11" value="4" />agree
<input type="radio" name="q11" value="3" />neutral
<input type="radio" name="q11" value="2" />disagree
<input type="radio" name="q11" value="1" />strongly disagree
<br />
<br />
12. The lab complemented my understanding of the lectures
<br />
<input type="radio" name="q12" value="5" />strongly agree
<input type="radio" name="q12" value="4" />agree
<input type="radio" name="q12" value="3" />neutral
<input type="radio" name="q12" value="2" />disagree
<input type="radio" name="q12" value="1" />strongly disagree
</fieldset>
<br />
<br />
<fieldset>
<legend> Instructor Specific Questions</legend>
1. The instructor clearly presented the skills to be learned
<br />
<input type="radio" name="q13" value="5" />strongly agree
<input type="radio" name="q13" value="4" />agree
<input type="radio" name="q13" value="3" />neutral
<input type="radio" name="q13" value="2" />disagree
<input type="radio" name="q13" value="1" />strongly disagree
<br />
<br />
2. The instructor effectively presented concepts and techniques
<br />
<input type="radio" name="q14" value="5" />strongly agree
<input type="radio" name="q14" value="4" />agree
<input type="radio" name="q14" value="3" />neutral
<input type="radio" name="q14" value="2" />disagree
<input type="radio" name="q14" value="1" />strongly disagree
<br />
<br />
3. The instructor presented content in an organized manner
<br />
<input type="radio" name="q15" value="5" />strongly agree
<input type="radio" name="q15" value="4" />agree
<input type="radio" name="q15" value="3" />neutral
<input type="radio" name="q15" value="2" />disagree
<input type="radio" name="q15" value="1" />strongly disagree
<br />
<br />
4. The instructor effectively presented the tools (e.g. materials, skills, and techniques) needed
<br />
<input type="radio" name="q16" value="5" />strongly agree
<input type="radio" name="q16" value="4" />agree
<input type="radio" name="q16" value="3" />neutral
<input type="radio" name="q16" value="2" />disagree
<input type="radio" name="q16" value="1" />strongly disagree
<br />
<br />
5. The instructor explained concepts clearly
<br />
<input type="radio" name="q17" value="5" />strongly agree
<input type="radio" name="q17" value="4" />agree
<input type="radio" name="q17" value="3" />neutral
<input type="radio" name="q17" value="2" />disagree
<input type="radio" name="q17" value="1" />strongly disagree
<br />
<br />
6. The instructor made the elements of good writing clear
<br />
<input type="radio" name="q18" value="5" />strongly agree
<input type="radio" name="q18" value="4" />agree
<input type="radio" name="q18" value="3" />neutral
<input type="radio" name="q18" value="2" />disagree
<input type="radio" name="q18" value="1" />strongly disagree
<br />
<br />
7. The instructor clearly articulated the standards of performance for the course
<br />
<input type="radio" name="q19" value="5" />strongly agree
<input type="radio" name="q19" value="4" />agree
<input type="radio" name="q19" value="3" />neutral
<input type="radio" name="q19" value="2" />disagree
<input type="radio" name="q19" value="1" />strongly disagree
<br />
<br />
8. The instructor provided guidance for understanding course exercises
<br />
<input type="radio" name="q20" value="5" />strongly agree
<input type="radio" name="q20" value="4" />agree
<input type="radio" name="q20" value="3" />neutral
<input type="radio" name="q20" value="2" />disagree
<input type="radio" name="q20" value="1" />strongly disagree
</fieldset>
Я хочу, чтобы я мог отображать каждый результат для каждого вопроса в одной и той же многострочнойтекстовое поле, но оно разбито на курсы и вопросы профессора:
КУРСЫ
Q1: Не согласен
Q2: Нейтрально
Q3: Нейтрально
и т. Д. *
ПРОФЕССОР
Q1: Не согласен
Q2: Нейтрально
Q3: нейтральный
и т.д ...