namespace Hr.ChkTime
{
    public partial class SignSetp1 : System.Web.UI.Page
    {
        string sNo = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            sNo = Request.QueryString["no"];            if (!IsPostBack)
            {
                //sNo = Request.QueryString["no"];                InitInfo();
                BindGrid();
            }
        }        protected void InitInfo()
        {
            string strSQL = "select a.*,b.emp_name from hr_sign a inner join hr_employee b on a.sign_empno=b.emp_no where a.sign_no='" + sNo + "' order by a.sign_step";
            DataTable dt = DBConnSql.GetDataTable(strSQL);            if (dt.Rows.Count > 0)
            {
                lbSignNo.Text = dt.Rows[0]["sign_no"].ToString();
                lbSignSender.Text = dt.Rows[0]["emp_name"].ToString();
                DateTime dtD1 = Convert.ToDateTime(dt.Rows[1]["sign_date"].ToString());
                System.TimeSpan TimeSpan = System.DateTime.Now - dtD1;
                int iSpan = TimeSpan.Hours;
                lbHours.Text = dt.Rows[1]["sign_date"].ToString() + " (停留时数:<b><font color=red>" + iSpan.ToString() + "</font></b>)";
            }
        }        protected void BindGrid()
        {
            string strSQL = "select * from hr_signkq where sign_no='" + sNo + "'";
            DataTable dt = DBConnSql.GetDataTable(strSQL);            GridView1.DataSource = dt;
            GridView1.DataBind();
        }        protected void radioSet_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (radioSet.SelectedValue == "1")
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        RadioButtonList rBtn = (RadioButtonList)GridView1.Rows[i].FindControl("radioSign");
                        rBtn.Items[0].Selected = true;
                    }
                }
            }
            if (radioSet.SelectedValue == "0")
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        RadioButtonList rBtn = (RadioButtonList)GridView1.Rows[i].FindControl("radioSign");
                        rBtn.Items[1].Selected = true;
                    }
                }
            }
        }
    }
}以上是全代码,主要问题在于最后一个radio控件事件:
            if (radioSet.SelectedValue == "1")
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        RadioButtonList rBtn = (RadioButtonList)GridView1.Rows[i].FindControl("radioSign");
                        rBtn.Items[0].Selected = true;
                    }
                }
            }            if (radioSet.SelectedValue == "0")
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        RadioButtonList rBtn = (RadioButtonList)GridView1.Rows[i].FindControl("radioSign");
                        rBtn.Items[1].Selected = true;
                    }
                }
            }这两个if中的内容,当value="0"时,可以正常执行,radio中的选项也会被选中;
当value="1"时,程序是正常执行,但radio中的选项不会改变;
这是为什么? 搞了半天也没找出原因。
各位帮帮忙看看问题出在哪里?谢谢了。