views:

20

answers:

1

In my project I have a web service that returns an Exam object. This object contains a property that returns set of multiple choice questions in Questions[] array. Each Question object in Questions array contains two properties, Question and ChoiceArray. To clear things here's the code,

Exam e = service.GetExam(long CenterID);

Questions[] questions = e.Questions;

foreach(Qestion question in questions)

{

    string q = question.Question;

    Choice[] choice = question.Choice;

}

I need to know a way I can all of these question and their choices onto a form. Since I have these as arrays I can not bind them properly using DataList. Any idea how to display these questions and their choices on to the form and on choice selection, get the value of the selected answer for each question back.

Thanks.

+1  A: 

You can use this method to convert the array to a List<string>:

http://www.dotnetspider.com/resources/19560-Convert-from-string-array-to-list-t.aspx

You can then bind to a RadioButtonList.

Dave Swersky
But that is one part. How do I generate a hierarchy of Questions and Choices, like if number of question returned are 10. For each question, display its list of choices, similarly for the second question, so on and so forth.
Ashar Syed