Solved

Conceptual brain picking (and once code question) - how might a true false quiz be built?

Posted on 2007-03-22
5
218 Views
Last Modified: 2013-11-26
I am practicing some coding, and want to build a page that has a series of questions with the answer options of true or false using asp.net (my current job uses asp.net1.1 so I need to hone skills using that version) . The quiz is data built as an xml file. Currently I am building it as a series of nested repeaters to build the question (Question stem, then the true and false choices). The snag I am having is accessing a specific property of each answer (distractor) element (isCorrect), to store in an array as the correct choice, to later step thru for scoring. I am attaching my XML below, but what I guess I am looking for is first, what command could I use in the code behind to get the "isCorrect" property, and more importantly, from a high level, conceptual, point of view, is there a better way for me to be building this type of page?
0
Comment
Question by:cbittner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 11

Accepted Solution

by:
ethoths earned 500 total points
ID: 18771066
Firstly I'd build the page from the XML using XSLT.
You could store the correct value in viewstate to prevent you having to parse the document twice.
Then, on post back, compare the viewstate values to the for submitted values.

That would be the easiest and most flexible way to do it although it does not realyy use too many of the ASP.Net features.
0
 

Author Comment

by:cbittner
ID: 18771298
Makes sense, I'll look into that now, but here is a question, xslt will format the XML into the format I want, but what I also need is the ability to perform logic on each question item loaded that says "ok, if this choice is the right answer, add my id to an array", so I can step thru that array to check the answers. Will I still have the ability to perform logic on each item in the xml file using xslt?
0
 

Author Comment

by:cbittner
ID: 18772026
ok, I am playing with the xslt approach, here is a question, how do I use server controls in an xslt template - it doesn't like the inclusion of the radioButton.

  <xsl:template match="question" >
    <tr  bgcolor="#FFFFE0">
    <td width="50%"><xsl:value-of select="stem"/></td>
    <td width="25%" align="center"><asp:RadioButton id="RadioButton1" runat="server"></asp:RadioButton><xsl:value-of select="distractor1" /> </td>
    <td width="25%" align="center"><xsl:value-of select="distractor2" /></td>
    </tr>
  </xsl:template>
0
 

Author Comment

by:cbittner
ID: 18772723
I am closing this because based on ethoths reply I am getting where I need to be.
0
 

Author Comment

by:cbittner
ID: 18782423
Actually after further review, I'm not thrilled with using xslt to build the question, adding server controls to the page is a nightmare.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question