?
Solved

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

Posted on 2007-03-22
5
Medium Priority
?
220 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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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 …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 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