ASCX Snippet: (note all formatting is gone so this really doesn't look good... but you get the point)
<asp:Repeater id="MyRepeater" runat="server">
<ItemTemplate>
<asp:RadioButton id="MyRepeatedButton01" runat="server" Groupname="Buttons" />
<asp:Label id="MyLabel01" runat="server" />
<asp:RadioButton id="MyRepeatedButton02" runat="server" Groupname="Buttons" />
<asp:Label id="MyLabel02" runat="server" />
<asp:RadioButton id="MyRepeatedButton03" runat="server" Groupname="Buttons" />
<asp:Label id="MyLabel03" runat="server" />
</ItemTemplate>
</asp:Repeater>
In the code-behind, I do something like this:
void MyRepeater_ItemDataBound(o
bject sender, RepeaterItemEventArgs e)
{
string[] sArray = SomeStringArrayRows[X].Tex
tVAlues[0.
..2];
for( int i = 0; i < X, i++ )
{
(Label)e.Item.FindControl(
"Label01).
Text = SomeStringArrayRows[i].Tex
tVAlues[0]
;
(Label)e.Item.FindControl(
"Label02).
Text = SomeStringArrayRows[i].Tex
tVAlues[1]
;
(Label)e.Item.FindControl(
"Label03).
Text = SomeStringArrayRows[i].Tex
tVAlues[2]
;
}
}
And, with formatting, this does something like -- each label has different text based on the data. However, the three radio buttons are being repeated X times as below:
O Label01Text
O Label02 Text
O Label03Text
O Label01Text
O Label02 Text
O Label03Text
O Label01Text
O Label02 Text
O Label03Text
:
:
O Label01Text
O Label02 Text
O Label03Text
X Times where X is the number of rows in my return from the datasource.
Question: I can check these guys and then I hit "submit" on my main form and go to the next page, but I need the values from the selected radio buttons. How do I determine which of the radio buttons displayed on the page was checked?
It's not easy as the number of overall radio buttons is created dynamically (in groups of threes). I need to know which of the radio buttons was selected out of each group of three. I have tried MANY THINGS but nothing works.
Thanks!
So, my HTML page will have multiple sets of radio buttons all created based on the number of rows from my datasource.