<asp:DataList ID="datalist_iq" runat="server" DataKeyField="id" BorderColor="Red"> <ItemTemplate> <table border="1"> <tr> <td> <asp:Label ID="label_question_head" runat="server" Style="word-wrap: break-word" Width="310px" Height="91px" Font-Bold="true" ForeColor="Maroon"> <%#Eval("q_head") %> </asp:Label> </td> </tr> <tr> <td rowspan="2"> <asp:RadioButtonList ID="RadioButton1" AutoPostBack="true" OnSelectedIndexChanged="RadioButton1_SelectedIndexChanged" DataTextField="a_head" DataValueField="result" runat="server" Visible="true" > </asp:RadioButtonList> </td> </tr> </table> </ItemTemplate> </asp:DataList>
protected void RadioButton1_SelectedIndexChanged(object sender, EventArgs e) { Label_result.Text = "good"; foreach (DataListItem dli in datalist_iq.Items) { rblfilteritem = (RadioButtonList)dli.FindControl("RadioButton1"); foreach (ListItem item in rblfilteritem.Items) { if (item.Selected) item.Selected = true; } Label_result.Text = rblfilteritem.SelectedItem.Text; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)