gridview中有一个CHECKBOX,现在向数据库插入里面的数据的时候,
如果有两个符合的,alert就会弹出两次,三个符合的就会出现三次,这个是什么问题。
怎么修改?
protected void btn2_Click(object sender, EventArgs e)
    {
         for(int i=0;i<gridview1.Rows.Count;i++ )
        {
             CheckBox cb = (CheckBox)gridview1.Rows[i].FindControl("CheckBox2");
             DropDownList ddl = (DropDownList)gridview1.Rows[i].FindControl("DropDownList1");
             TextBox tb1 = (TextBox)gridview1.Rows[i].FindControl("TextBox21");
             string va1=((Label)gridview1.Rows[i].FindControl("Label1")).Text.Trim();
             string va2=((Label)gridview1.Rows[i].FindControl("Label2")).Text.Trim();
             string va3=((Label)gridview1.Rows[i].FindControl("Label3")).Text.Trim();  
             if (cb.Checked && tb1.Text.Length == 0)
             {
                 label1.Visible = true;
                 Response.Write("<script>alert('请输入转正理由')</script>");
             }
            else if (cb.Checked&&tb1.Text.Length!=0)
            {
                SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["strCon"]);
                con.Open();
                string sql = "insert into temp(kb,jz,lb) values('" + va1 + "','" + va2 + "','" + va3 + "')";
               SqlCommand com = new SqlCommand(sql, con);
               try
               {
                   com.ExecuteNonQuery();
               }
               catch (MembershipCreateUserException ex)
               {
               }
               Response.Write("<script>alert('提交成功')</script>");
               con.Close();
           }
}
}