Question

We need to create a quiz application in SharePoint 2013. We have already created a quiz by write questions in aspx page and writing its code in aspx.cs page and the quiz is running fine.

But the requirement is we need to fetch questions also from SharePoint list and display them and store the answers. The problem we are facing is that we are able to retieve questions but not able to display in the form. Only the final question is getting displayed. It is reading all the questions , but only final question is getting printed. In aspx page we only wrote code for one question and solutions as the code for iteration of the list is written in the cs page. But we are not able to display all the questions in the form.

Can anyone please send the code of aspx and aspx.cs page where we can display the question with 4 radio options of a set of questions?

Thanks in advance.

Screenshot of cs enter image description here

Screenshot of aspx page enter image description here

The output is displayed like the screenshot attached below: enter image description here

No correct solution

OTHER TIPS

Only last question is getting displayed, because your aspx design and code is not correct.

  1. You are looping the code for each item but you do not have that many set of controls in aspx page.
  2. You have only one set of control, which is getting overwritten by last question.

To resolve the issue either:

  1. You will need to add set of controls(question label and radiobuttons) in aspx page similar to no of questions you have
  2. Or create dynamic controls in code for each question-answer and add those control in aspx page using may be panel control
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top