chpicker
Programmer
- Apr 10, 2001
- 1,316
I've been fighting ASP over this problem for a week now and I just can't figure out how to do it.
I'm using a GridView as an example. I don't strictly need to use it; I could use any of the other data display controls if you think that would work better. GridView is what I've been trying to use.
Let's say I'm creating an online test. The questions and answers are in a SQL Server table. Each question can have any number of answers, but only one answer is correct. So I populate the GridView with a Select statement that gives me one row per question. In the RowDataBound event, I perform another Select to get the answers to that row's question. What I need to figure out is: 1) How do I put these answers into radio buttons? 2) How do I read all of the answers at once when the user clicks Submit?
I'm seriously at a loss. I created a TemplateField with an <asp:RadioButtonList> control. I haven't been successful with using FindControl to get the RadioButtonList; I keep getting the "not set to an instance of an object" error.
Has anyone done what I'm trying to do? How do you populate each radio button set, and how do you read them all back after submission?
Ian
I'm using a GridView as an example. I don't strictly need to use it; I could use any of the other data display controls if you think that would work better. GridView is what I've been trying to use.
Let's say I'm creating an online test. The questions and answers are in a SQL Server table. Each question can have any number of answers, but only one answer is correct. So I populate the GridView with a Select statement that gives me one row per question. In the RowDataBound event, I perform another Select to get the answers to that row's question. What I need to figure out is: 1) How do I put these answers into radio buttons? 2) How do I read all of the answers at once when the user clicks Submit?
I'm seriously at a loss. I created a TemplateField with an <asp:RadioButtonList> control. I haven't been successful with using FindControl to get the RadioButtonList; I keep getting the "not set to an instance of an object" error.
Has anyone done what I'm trying to do? How do you populate each radio button set, and how do you read them all back after submission?
Ian