inserting multiple records.....

B

Brian

I need help PLEASEEEEEEEEEEEEEEE.....

I am trying to create a list of questions that have yes/no answers.
There are 8 groups of questions. Based on who the user is that logs in
will determine what groups of yes/no questions they will get... The way
I was trying to do it, was to store each group of questions as one
record. Then all I had to do is do a query and use a Repeater to show
only the groups that I needed. That part works great.. Now I need to
take the answers to these questions and insert them into a table. Each
answer must be a separate record. I thought about using the
commandbuilder, however, I dont know how to loop through each question.
I am also using plain radio buttons as opposed to asp:radiobuttons. I
am desperate here.. Please help me through this.. If there is a better
way, I would love to hear it... Some sample code would be great too..

thanks...
 
J

John Timney \(ASP.NET MVP\)

The Controls property is a collection that supports the IEnumerable
interface, you can simple iterate through the collection using a foreach
loop to pick out dynamically created controls. Have a run through the code
to see what your repeater produces as output and go from there.

<script runat="server" language="C#">
void Page_Load(Object sender, EventArgs e)
{
foreach(Control c in Controls)
lblControlList.Text += c.ToString() + " - " + c.ID + "<br>";
}
</script>

<html>
<head>
</head>
<body>
<b>A List of the Controls in the
<code>Controls</code> Collection</b><br>
<asp:label runat="server" id="lblControlList" />
<p>
<form runat="server">
What's your name?
<asp:textbox runat="Server" id="txtName" />
</form>
</body>
</html>




--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
B

Brian

Hey John,

Thanks for the response... The radio buttons aren't actually
dynamically generated.. I am just holding the html code for them in a
table, so when it renders on the page, it just looks like a plain form.
I am also using regular radiobuttons.. not asp:radiobuttons, so I
can't use the runat=server attribute..

Here is a snippet of my code..

P.S. I am using VB..

<table width="100%" border="0" cellspacing="0"
cellpadding="0"><ASP:Repeater runat="server"
id="QuestionGrid"><headertemplate><tr><td></td>
</tr></headertemplate>
<ItemTemplate>
<tr>
<td >
<%# DataBinder.Eval(Container.DataItem, "QuestionHTML") %>
<br>
<br>
</td>
</tr></ItemTemplate>
<footertemplate><tr>
<td></td>
</tr></footertemplate>

</ASP:Repeater></table>
 
J

John Timney \(ASP.NET MVP\)

then just iterate through the request.form values

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
B

Brian

Is it possible to do something like this? "My favorite color is blue
yes / no " with asp:radiobuttons????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top