GridView显示的字段内容如下      技术名称             一年经验            一到三年经验         三年以上经验
<%# Eval(“name”)%>  RadioButton1控件  RadioButton1控件   RadioButton1控件
     用户可以通过点击RadioButton控件选择经验年限,之后点击”确定”按钮向数据库中提交技术名称和选中的工作年限。
  请问改如何提交?如何遍历GridView的每条记录来得到工作年限呢?

解决方案 »

  1.   

    你把技术名称,绑定到一个隐藏控件上,在后台通过Findcotrol("控件名")来找到控件去得值.
    顺便打个广告.
    兼职网赚网
    http://www.clickemoney.net 
      

  2.   

    首先把你的技术名称的值放到一个Label标签里更好处理
        protected void Button1_Click(object sender, EventArgs e)
        {
            Lable l;
    RadioButton r1;
    RadioButton r2;
    RadioButton r3;
            foreach (GridViewRow grv in GridView1.Rows)
            {
                l = (Label)grv.FindControl("Lable1");
                r1 = (RadioButton)grv.FindControl("RadioButton1");
                r2 = (RadioButton)grv.FindControl("RadioButton2");
                r3 = (RadioButton)grv.FindControl("RadioButton3");
                if (r1.Checked)
        {
    //...
                }
                if (r2.Checked)
        {
    //...
                }
                if (r3.Checked)
        {
    //...
                }
        }