C#单选题代码

来源:百度知道 编辑:UC知道 时间:2024/09/25 23:15:51
protected void Button1_Click(object sender, EventArgs e)
{
int a = 0;
if (RadioButton2.Checked)
a= a + 10;
if (RadioButton5.Checked)
a = a + 10;
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[1].Selected)
break;
if (CheckBoxList1.Items[i].Selected)
a= a+ 10;
}

TextBox1.Text= Convert.ToString(a);
}

protected void Button2_Click(object sender, EventArgs e)
{
“A”
CheckBoxList1.SelectedIndex = -1;
this.TextBox1.Text = " "; }

A怎么写?

注意:
CheckBoxList1.SelectedIndex = -1; 这是对的
我要清空的是:单选的两个单选题8个RadioButton中任意两个
(我没用RadioButtonList1组合框)
例如单选题
1, A B C D
2 ,A B C D
重置
选择1A2C或1B2C后,单击‘重置’按钮后回到原始没做状态

不是很明了你的意思,不过试试用给IsCkecked属性赋值false看看吧
唔,那就应该是差不多啊,你试试呢

你要搞的是这样么?
-------------------
|□A.第1个
|□B.第2个
|□C.第3个
|□D.第4个
|--------------------