Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
| Search | Today's Posts | Mark Forums Read
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2011, 04:26 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Radio button:the challenge is how to validate the selected radio button against the "

I am to develop a quiz application.
DETAILS,
1. there is a table containing the following fields(questions,optionA,optionB,optionC,optionD and Answer)

2. the interface has one label and four radio buttons. I bound these to the table respectively

3. the challenge is how to validate the selected radio button against the "answer" fields. and then stepping forward for the next iteration while keeping count of the correct and wrong answer.
 
Old December 1st, 2011, 10:54 AM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Wink Online Quiz

Quote:
Originally Posted by adamolekunfemi View Post
I am to develop a quiz application.
DETAILS,
1. there is a table containing the following fields(questions,optionA,optionB,optionC,optionD and Answer)

2. the interface has one label and four radio buttons. I bound these to the table respectively

3. the challenge is how to validate the selected radio button against the "answer" fields. and then stepping forward for the next iteration while keeping count of the correct and wrong answer.
I am working on basically the same thing with 16 questions in a single page Form, using radiobuttons (A,B,C,D) and a single submit button at the bottom of the page. I have validation figured out and will post the code here this evening. My issue is getting CRUD (Create, Read, Update and Delete), specifically Create(Insert) to insert all the selections into my database table. So hopefully we can both work this all out here.

We may have different approaches to the exam.
My online exam presents the user with one single page Form (trying to keep it "simple") displaying 16 multiple choice questions (A,B,C,D) with a comment textarea below each question. I am using RadioButtonList for the selections. Each RadioButtonList has a separate ID with ListItem for each radiobutton. There is a single submit button at the very bottom after the last question. Upon clicking the button, validation checks to make sure a selection has been made (in other words ALL questions must be answered before submission is valid) for each question. If all questions are answered the user is sent to another page where the questions along with the selected answers and comments are displayed. My next step is to get all the selections inserted into my database table, which is proving to be THE challenge.

Check out my code here: Multiple Choice Online Exam

Last edited by jpjamie; December 1st, 2011 at 11:30 AM..
 
Old December 4th, 2011, 09:00 PM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Default C# Code Needed in Code Behind File

I felt I needed to reply to my own post here and I hope others can benefit from this.
I now realize I need to write C# code in my code behind file for my quiz form to first connect to my SQL server (CommandBuilder, DataAdapter) database table and provide CRUD for my quiz.
While GridView and DetailsView "work" for basic CRUD functionality, the end user interface is basically the same every time. They DO however, provide and guide you with the database connectionstring and other useful code which can be used in your C# hard coding.
While GridView and DetailsView assist and validate your database connection for basic CRUD, you're left on your own if you want to design a user interface outside of their "wizard sandbox" with C# coding.
While there's a LOT going on "under the hood" with Visual Studio 2010, don't expect the wizards to get it ALL done for you without a considerable amount of C# coding!




Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I validate a radio button group whyulil ASP.NET 2.0 Basics 1 January 10th, 2007 10:44 AM
binding textboxes to selected radio button abhi_loveu2002 ASP.NET 2.0 Basics 0 December 20th, 2006 05:54 AM
Radio Button hoailing22 ASP.NET 1.0 and 1.1 Basics 1 June 2nd, 2005 12:08 AM
Page display based on radio button selected Mekala HTML Code Clinic 3 July 10th, 2004 06:12 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.