Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > inserting multiple records.....

Reply
Thread Tools

inserting multiple records.....

 
 
Brian
Guest
Posts: n/a
 
      02-22-2005
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...

 
Reply With Quote
 
 
 
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      02-22-2005
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

"Brian" <> wrote in message
news: ups.com...
> 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...
>



 
Reply With Quote
 
 
 
 
Brian
Guest
Posts: n/a
 
      02-22-2005
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>

 
Reply With Quote
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      02-22-2005
then just iterate through the request.form values

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Brian" <> wrote in message
news: oups.com...
> 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>
>



 
Reply With Quote
 
Brian
Guest
Posts: n/a
 
      02-23-2005
Is it possible to do something like this? "My favorite color is blue
yes / no " with asp:radiobuttons????

 
Reply With Quote
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      02-24-2005
Heres a good tutorial on creating a atabound list of asp.net radio controls

http://www.4guysfromrolla.com/webtech/072701-1.shtml

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Brian" <> wrote in message
news: oups.com...
> Is it possible to do something like this? "My favorite color is blue
> yes / no " with asp:radiobuttons????
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting multiple rows from array David Lelong Ruby 3 11-24-2006 04:05 AM
ASP .NET 2.0 - Multiple Formviews - inserting data Bob ASP .Net Web Controls 0 04-08-2006 05:38 PM
Inserting Multiple row at a time in VB.Net JAPHET ASP .Net Web Controls 0 10-12-2004 09:31 AM
Inserting Multiple Rows Arsen V. ASP .Net 5 08-25-2004 01:41 PM
inserting to multiple tables in one form Tyro ASP .Net 2 03-03-2004 07:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57