J
Josh Valino
Hi,
I have a webform that lists poeple from a database and has a radiobutton
list for each person. I want to go down the list and select a radio button
for each person, then save those selections to a database. But in order to
save the selections to the database, I need to get back the ID of the person
who is associated with each radiobutton list. How do I make this
association? I am generating my list in a repeater like so:
<asp:Repeater ID="r1" runat="server">
<ItemTemplate>
<tr>
<td width="50%">
<asp:Label ID="lblName" runat="server" />
</td>
<td>
<asp:RadioButtonList ID="rad" runat="server">
<asp:ListItem Value="Phone" Text="Phone" />
<asp:ListItem Value="Mail" Text="Mail" />
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
My data source is a datatable that would look like this if viewed as raw
data:
PersonID PersonName ContactMethod
1 Joe Smith [this is what I need to update]
2 Mary Jones
I want to have a method that will loop through all the radiobutton lists
that wound up being created and save the selection for each given person, by
PersonID. I'm still stuck in the classic ASP way of thinking where I'd just
name the radiobuttons rad<%=personID%> and then parse it back out of the
items in the form collection when submitted. How do I achieve this in .net?
2.0
TIA,
Josh
I have a webform that lists poeple from a database and has a radiobutton
list for each person. I want to go down the list and select a radio button
for each person, then save those selections to a database. But in order to
save the selections to the database, I need to get back the ID of the person
who is associated with each radiobutton list. How do I make this
association? I am generating my list in a repeater like so:
<asp:Repeater ID="r1" runat="server">
<ItemTemplate>
<tr>
<td width="50%">
<asp:Label ID="lblName" runat="server" />
</td>
<td>
<asp:RadioButtonList ID="rad" runat="server">
<asp:ListItem Value="Phone" Text="Phone" />
<asp:ListItem Value="Mail" Text="Mail" />
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
My data source is a datatable that would look like this if viewed as raw
data:
PersonID PersonName ContactMethod
1 Joe Smith [this is what I need to update]
2 Mary Jones
I want to have a method that will loop through all the radiobutton lists
that wound up being created and save the selection for each given person, by
PersonID. I'm still stuck in the classic ASP way of thinking where I'd just
name the radiobuttons rad<%=personID%> and then parse it back out of the
items in the form collection when submitted. How do I achieve this in .net?
2.0
TIA,
Josh