Link to home
Start Free TrialLog in
Avatar of cbittner
cbittner

asked on

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

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?
ASKER CERTIFIED SOLUTION
Avatar of ethoths
ethoths

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cbittner
cbittner

ASKER

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?
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>
I am closing this because based on ethoths reply I am getting where I need to be.
Actually after further review, I'm not thrilled with using xslt to build the question, adding server controls to the page is a nightmare.