注册 登录
编程论坛 ASP.NET技术论坛

RadioButton 问题

jalonlovesja 发布于 2008-02-19 18:04, 1078 次点击
int Check=0;
默认RadioButton1是选中的,RadioButton1值为0
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        if (RadioButton2.Checked)
        {
            Check = 1;
        }
    }
数据也插入成功了,可是查询表中的记录的时候RadioButton一直都是1了??无论我选中哪个都是一样的结果了
  这个问题怎么解决了??
4 回复
#2
冰彩虹2008-02-19 23:18
你这只是对选中的情况下进行赋值,可你没有选中的情况下什么也没做,Check就一直是1了
#3
jalonlovesja2008-02-22 11:48
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        if (RadioButton2.Checked)
        {
            Check = 1;
        }
        else
         {
             Check = 0;
         }
    }
如果是这样判断的话,它的值还是没有改变了
#4
kevintang2008-02-22 16:13
aaaa
你有没有去个radio组的名称啊!
       不燃是不互斥的啊!
#5
jalonlovesja2008-02-23 09:45
解决了,谢谢了
1