inserting multiple records.....

Discussion in 'ASP .Net' started by Brian, Feb 22, 2005.

  1. Brian

    Brian Guest

    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...
    Brian, Feb 22, 2005
    #1
    1. Advertising

  2. 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:...
    > 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...
    >
    John Timney \(ASP.NET MVP\), Feb 22, 2005
    #2
    1. Advertising

  3. Brian

    Brian Guest

    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>
    Brian, Feb 22, 2005
    #3
  4. then just iterate through the request.form values

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "Brian" <> wrote in message
    news:...
    > 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>
    >
    John Timney \(ASP.NET MVP\), Feb 22, 2005
    #4
  5. Brian

    Brian Guest

    Is it possible to do something like this? "My favorite color is blue
    yes / no " with asp:radiobuttons????
    Brian, Feb 23, 2005
    #5
  6. 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:...
    > Is it possible to do something like this? "My favorite color is blue
    > yes / no " with asp:radiobuttons????
    >
    John Timney \(ASP.NET MVP\), Feb 24, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. blenderdude

    Inserting Records with Bound Controls

    blenderdude, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    blenderdude
    Jul 21, 2003
  2. Muhammad Usman
    Replies:
    1
    Views:
    1,091
    Raja Saravanan
    Oct 16, 2003
  3. Bijoy Naick

    Inserting Records from another table

    Bijoy Naick, Jun 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    334
    Steve C. Orr [MVP, MCSD]
    Jun 30, 2004
  4. Chumley the Walrus
    Replies:
    1
    Views:
    368
    Mark Rae
    Aug 12, 2004
  5. Brian Ciarcia

    Help inserting Records

    Brian Ciarcia, Mar 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    382
    Brian Ciarcia
    Mar 4, 2005
Loading...

Share This Page