例如,我有两个单选按钮列表:
<asp:RadioButtonList ID="rbl1" runat="server" OnSelectedIndexChanged="rbl1_SelectedIndexChanged" AutoPostBack="True" >
<asp:ListItem Value="1"> 1</asp:ListItem>
<asp:ListItem Value="2"> 2</asp:ListItem>
<asp:ListItem Value="3"> 3</asp:ListItem>
<asp:ListItem Value="4"> 4</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="rbl2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="rbl2_SelectedIndexChanged" >
<asp:ListItem Value="1"> 1</asp:ListItem>
<asp:ListItem Value="2"> 2</asp:ListItem>
<asp:ListItem Value="3"> 3</asp:ListItem>
<asp:ListItem Value="4"> 4</asp:ListItem>
</asp:RadioButtonList>
protected void rbl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbl1.SelectedIndex == 1)
{
Label1.Text = "Correct Answer.";
}
else
{
Label1.Text = "Incorect";
}
}
protected void rbl2_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbl2.SelectedIndex == 0)
{
Label2.Text = "Correct Answer";
}
else
{
Label2.Text = "Incorect";
}
我想如果rbl1 selectedindex = 1则向标签(如Lable3)添加1个值,以显示rbl2 selectedindex = 0时,再次将label3中先前的分数加1。
请帮助我,谢谢。