Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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