Solved

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

Posted on 2007-03-22
5
208 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now